homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

run .exe

 3:25 am on May 11, 2007 (gmt 0)

hi all,
In my IIS, example: I have a php file (index.php), and a .exe file (sample.exe). In my index.php, I have a link or button call 'Run Exe' which I want when user click on it, then sample.exe will be run. Can it be done? Any sample of code?

Thanks in advances.



 3:39 am on May 11, 2007 (gmt 0)

You should be able to use the program execution functions [us.php.net] to accomplish what you want. :)

This way, you don't even need the executable in the web root, but you can have it below it, too.


 3:55 am on May 11, 2007 (gmt 0)

Is sample.exe a cgi compatible program?

Will the user be interacting with the exe, or just causing a chain of events to happen(updating info somewhere else)?


 5:16 am on May 11, 2007 (gmt 0)

I didn't get what I want. Below is my script in php

exec (" run c:/folder/sample.exe",$status);
echo "Exit status code of command is $status";

the out put is "Exit status code of command is Array"

sample.exe is a application program (FoxPro).

Any guides?


 7:32 am on May 11, 2007 (gmt 0)

I have trued this:
function cmd($command, $arguments = null)
$commandline = '';
foreach(func_get_args() as $word) {
$commandline .= '"' . $word . '"';
$commandline = rtrim($commandline, '');
$commandline = '"' . $commandline . '"';
return `$commandline`;


if($com=new COM("WScript.Shell")) echo "yes";
echo "can not exec()";
} else{
echo"can run exec()";

I got the answer 'can run exec()' BUT I cannot see the interface of the sample.exe. Anything I have missed in the command?


 10:15 am on May 11, 2007 (gmt 0)


Would I be correct in thinking that running the .exe from PHP will run it in the server and not on the client?

If so you will never get to see the interface because it is being run on the server.


 10:44 am on May 11, 2007 (gmt 0)

Yes, it is executing it on the server. If you want it to be run on the clients computer, they are going to have to download it either to a temporary file and then "open" it, or "save as" it to their computer and then run it. It should prompt for either of these if they go to the uri where the file is located.


 11:23 am on May 11, 2007 (gmt 0)

thanks for reply.
then is it any alternative ways for me to run the exe at client site?

can it be done if i use patch file to open the exe? but i no idea with path command.....

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved