Is it possible to run an exe file directly from the server without downloading/saving into the client machine?
I had used that exec() function .But it is showing no display.

<?php

echo exec("d:\example\php_exe\1436.exe");

?>

Any body knows please help me.

    divyasmk wrote:

    Is it possible to run an exe file directly from the server without downloading/saving into the client machine?

    That depends... what do you mean "from the server" ? Are you asking if you can use PHP to secretly execute any file you wish on the client's computer without their knowledge? I would hope that such a question doesn't even need an explicit answer. 😉

    divyasmk wrote:

    I had used that exec() function .But it is showing no display.

    That's probably because you didn't specify a valid path. Since you didn't escape the backslashes, you're telling PHP to execute:

    d:\example\php_exec6.exe

      I want to run an exe on webserver and to send the output to the client..
      Actually I had library management project.
      In which books are stored as .exe files.
      I want to run it without saving or downloading.

        As brad said, escape your backslashes: \. Or why not use slash instead: /.

          I used as following
          <php
          echo exec('d:\example\php_exe\1436.exe');
          ?>

          But No display...Blank screen....

            Edit php.ini so that error reporting is on by default (log and/or output) and that error_level is set to report all errors, warnings etc, since you may have a parse error that prevents your script from executing at all.
            However, you should also read the documentation for [man]exec[/man] since you may get output that you don't see. E.g. the last line may contain a whitespace.

            You could of course also add extra output to determine how things really are proceeding, for example by echo 'before exec' before your line above, and echo 'after exec' after that line...

              Write a Reply...