Welcome to WebmasterWorld Guest from 54.226.60.235

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

run .exe

     

yllai

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

10+ Year Member



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.

eelixduppy

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

WebmasterWorld Senior Member eelixduppy is a WebmasterWorld Top Contributor of All Time 5+ Year Member



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.

Slade

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

10+ Year Member



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)?

yllai

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

10+ Year Member



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?

yllai

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

10+ Year Member



I have trued this:
<?php
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";
$cmd="C:\sample.exe";
if(!$cmd1=$com->exec($cmd))
{
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?

mikeyb

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

10+ Year Member



Hi,

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.

eelixduppy

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

WebmasterWorld Senior Member eelixduppy is a WebmasterWorld Top Contributor of All Time 5+ Year Member



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.

yllai

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

10+ Year Member



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.....

 

Featured Threads

Hot Threads This Week

Hot Threads This Month