Jump to content

Launch an Executable with PHP


rick2302

Recommended Posts

Am trying to use PHP to launch an Executable file on the Server.The server is on a local network, not the web, so we're not worried about permissions or anything.Have been trying fopen() with no luck.A hyperlink works fine, but we'd rather the user not have to click anything. Once the page loads, the executable should launch.

Link to comment
Share on other sites

You can't use PHP to run a program on the client machine. You can use something like exec to run a program on the server, but the users won't see the program. If you want the program to run on the client machine then the user has to click a link to launch it.

Link to comment
Share on other sites

Something like setting the window.location to the program's executable would also start the program I think and automatically, but the user would (naturally) be promted if (s)he wants to open the executable, save it or cancel the opening.

Link to comment
Share on other sites

I have PHP writing the HTML so just before the </body> added this:echo ' <script type="text/javascript"> window.location="file://MenuShare/ShowMenu.bat"; </script>';and it works fine, launching the Batch file that in turn launches the Executable.I found that trying to launch the Executable directly caused two prompts to "Run", whereas using the Batch file only prompts once. That is still one too many (would rather zero interaction from the user), but at least the user does not have to launch the executable themselves, just needs to acknowledge the "Run".Thanks for the suggestions!!

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...