0

I need to execute a .exe file located in C:\Program Files\ABC\test.exe on my windows machine using PHP. I have installed WAMPP/XAMPP to run PHP. I have tried the exec() system() shell_exec() but I'm unable to run the file. Can someone help me with the exact code?

5
Contributors
7
Replies
16
Views
7 Years
Discussion Span
Last Post by chrishea
0

have you tried passthru() it is similar to the system command. If it does not work then it is probable that these command are disabled by your hosting provider.

0

Can you provide me the exact code of passthru() ?
I am using WAMPP on my local machine to test it. If the commands are disabled, can you help me identify and enable them?

0

I need a execute a windows application from PHP. My whole website will be placed on a web hosting, just one process will run from my local system which will act as a web server and execute the windows application.

0

I did some experimenting with Exec.

I had no problem starting a local program with Exec with one exception. If the path name contains a blank, I wasn't able to get it to work. Even if the actual program name contains a blank, it works. One simple example that worked was:

$addr = "c:/Temp/TSP/TSP2.exe";
exec ($addr,$output, $return);

$output has the display output from the program if it is writing to the current window. If it opens in its own window then you see the output there. An example of getting the output from the current window is as follows:

exec("ping google.com", $output, $return);
    echo "The command returned $return, and output:\n";
    echo "<br><br><b>PING </b><br><pre>";
    echo "<pre>";
    var_dump($output);
    echo "</pre>";
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.