Page 1 of 1

PHP exec in foreground

Posted: Tue Feb 09, 2016 2:54 am
by FeedTheMeat
I am setting up a website for my friends and I to use as a control panel for our private game server computer. On that computer we have 3 exe files (we'll call them game1.exe, game2.exe, and VOIP.exe). I need 3 buttons on my website. Start, Stop, Restart. Now here is the issue that I run into. If I use

Code: Select all

shell_exec("/start game1.exe")
it opens in backround and immediately crashes (Cannot be run in background.) If I use

Code: Select all

exec("psexec -i -d -accepteula game1.exe")
it does the same thing. I have, of course, also tried

Code: Select all

exec("game1.exe")
I have also tried those examples with backtick and single quote. I have spent around two months trying to get 3 buttons working :lol: :lol: :lol: .

So game1.exe has to execute in foreground. I can't even start trying to figure out the others until I figure out how to start at least one of them. Any ideas or suggestions would be helpful.

My setup is as follows:
Windows 10

Using Administrator account

IIS 10 (Apache has given me error after error and I have spent three weeks trying to get that running to no avail.)

IIS Admin Service -> LogOn -> Interact With Desktop box checked

Re: PHP exec in foreground

Posted: Tue Feb 09, 2016 9:40 am
by Christopher
You might want to look at the Windows "start" command. The PHP script is going to exit, so you need to fork a new shell for the program to keep running.