Run C # Application in PHP

I am new to PHP and I am trying to run a C # application I have developed from my PHP project. The application is local and resides on the same computer as the server.
I only have to execute the application (preferably running it in the background), as its output is printed in a separate file that I receive on my website.

Is there a way to launch the application from my site? I tried to use echo exec(...)

it but it doesn't work.

+3


source to share


1 answer


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 information: http://php.net/manual/en/function.exec.php

Also, the user running the web server will need elevated permissions.

+2


source







All Articles