Run Windows Command from PHP Site

General discussion on PHP

Run Windows Command from PHP Site

Postby jord1322 on Fri Sep 29, 2017 2:34 pm

Hey,

I'm trying to figure out how to setup an application to be able to kickoff (open) a desktop application, specifically Google Earth in this case, from my site (it's a company intranet site). I found some information about using file_put_contents() to create a .bat file with the command, 'start "" "C:\Program Files (x86)\Google\Google Earth Pro\client\googleearth.exe" /b "" "googleearth.exe"' and then using the exec() command to execute it, but I keep getting a 126 error saying that it could not be executed. I have confirmed that the file is being created, and when I open it directly from the folder on the server it does exactly as expected and opens Google Earth so the command itself works apparently, but I'm having no luck in getting the exec() command on the site to launch it.

I've heard that it might could be a permissions issues, but my understanding of much of the server stuff is vague at best, and I'm not sure what to do. Some of the other things I've looked at mention that they only open the application in the background, which is not enough for what I'm needing, I need it to actually open up the GUI for the user. Any guidance on how to accomplish this would be appreciated.
Thanks,
Jordon Greene
PHP Full Stack Developer
SHOE SHOW, Inc.
jord1322
 
Posts: 35
Joined: Mon Nov 03, 2014 3:49 pm
Location: Concord, North Carolina

Re: Run Windows Command from PHP Site

Postby ally6142 on Wed Oct 04, 2017 1:34 pm

All things considered, its a pleasant post. I lean toward Windows, dependably. Attempted a great deal of times other OS's yet they cannot do simple things like Windows do.
ally6142
 
Posts: 1
Joined: Wed Oct 04, 2017 1:20 pm


Return to PHP

Who is online

Users browsing this forum: No registered users and 1 guest