I am new to PHP and I am trying to run a c# application I've developed, from my PHP project. The app is local and is on the same machine as the server.
I should only be able to execute the app (preferably run it in background), since it's output is printed in a separate file which I access in my website.
Is there any way to run the app from my website ? I've tried to use echo exec(...) but it won't work.
Use something like:
<?php
function _exec($cmd)
{
$WshShell = new COM("WScript.Shell");
$oExec = $WshShell->Run($cmd, 0,false);
echo $cmd;
return $oExec == 0 ? true : false;
}
_exec("yourprogram.exe");
?>
More info at: http://php.net/manual/en/function.exec.php
Also the user running the web server will need elevated permissions.
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