
This is more PHP-related and has less to do with the OTTD-code itsself... But I thought this would be the right place to go with my issue...
I want to be able to start and stop my OpenTTD dedicated server from any computer through a kind of "web-client". It's just a small thing with a few lines of code, consisting of a form asking for a username and a password, and if you are logged in you have three links "start server", "stop server", and "logout". Killing the openttd.exe-Process is no problem.
It's a Windows-Server, so I use
Code: Select all
taskkill /F /IM openttd.exe
But I can't get the function for starting the server to work!
I tried to execute ""C:\\OpenTTD\\openttd.exe -D" with exec and system commands, which did indeed open a openttd.exe-process (I could even see it in the taskmanager), but didn't start the server. And additionally, php was waiting for the process to end, so the browser kept on loading and loading... I found out that his is normal behaviour for the php execution commands and you can get around it by passing the output to a file. So I tried to do that with a code I found via google
Code: Select all
shell_exec("C:\\OpenTTD\\openttd.exe -D >temp.log 2>&1 &");
By the way I tried that line with exec() and system() and with the path "C:\OpenTTD\openttd.exe -D" and "C:/OpenTTD/openttd.exe -D" in all combinations, without success...
The idea behind that came to me when my Server crashed at the beginning of this week and I - studying in another city - was not able to start it again.
Does anybody know how to get it to work? How do other webclients start their programs? I hope there is a way, as the last option would be a remote-software...
Thanks!!
Connum