3

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.

1 Answer 1

2

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.

Sign up to request clarification or add additional context in comments.

1 Comment

Can we pass parameter to the .exe file that the C# application can use? Thanks.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.