I want php file to run exe file and display the exe file content when user goes to a particular url. I am trying to run exe file using php function exec('abc.exe');. But I only see blank page.
Anyone know how to solve it or how to run exe file from php file correctly? Many thanks in advance.
You can run any command you want using exec or shell_exec in php.
To access the operating system with php you do the following
$answer = shell_exec("abc.exe");
echo $answer."</br>";
The $answer string will contain the information that the abc.exe prints out or returns.
You may need to format it using explode().
You can only run exe files if your php is runnning on a Windows machine. Futhermore, if you are on shared hostig, your hoster may have disabled the exec command.
If you are on a Windows machine, 'abc.exe' must be in the current directory or in the PATH.
To capture the output use:
exec( 'abc.exe', &$output);
echo $output;
Link to exec
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With