PHP exec in foreground

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
FeedTheMeat
Forum Newbie
Posts: 1
Joined: Tue Feb 09, 2016 2:38 am

PHP exec in foreground

Post 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
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: PHP exec in foreground

Post 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.
(#10850)
Post Reply