Run server using PHP...
by raa brubb · in Torque 3D Professional · 02/14/2014 (6:31 pm) · 4 replies
Hey all,
Recently I got a server online that is basically for web hosting. I can upload files, but I can't execute them directly. So I was wondering if it was possible to have an HTML file that links to a PHP file. The PHP files is actually a script which starts the server and it starts up! I may be talking nonsense but I was wondering if I could use a PHP file to start a server. Has anyone done this before or know how to?
Note: The hosting service I talked about is byethost.com, check it out if you need. Thanks!
Recently I got a server online that is basically for web hosting. I can upload files, but I can't execute them directly. So I was wondering if it was possible to have an HTML file that links to a PHP file. The PHP files is actually a script which starts the server and it starts up! I may be talking nonsense but I was wondering if I could use a PHP file to start a server. Has anyone done this before or know how to?
Note: The hosting service I talked about is byethost.com, check it out if you need. Thanks!
About the author
#2
Thanks all for the support and help on the community, it inspires me to give something back, so my GMK patch will be out soon, I will look into integrating Guidebot, FXAA, and other cool stuff. Thanks all for your help!
02/15/2014 (11:39 am)
Ok, thanks for the info. I just signed up for a free VPS that runs Ubuntu 13.10, so I wanted to have a Torque3D game server. If anyone knows how to do that it would help with the input.Thanks all for the support and help on the community, it inspires me to give something back, so my GMK patch will be out soon, I will look into integrating Guidebot, FXAA, and other cool stuff. Thanks all for your help!
#4
02/19/2014 (7:43 am)
Essentially what you want to do is code some form of timer interval where Torque (or even some external program) can read from the PHP script, you can transmit details down such as server settings, ect, and then you'll run a check to see if the server is already running and if now, launch the server program.
Andrew Mac
However, if you want your php script to continue to execute after the user has closed the page, you need to fork the script to another process using pcntl_fork. Here's the php docs for that function:
ca2.php.net/pcntl_fork
It's not very difficult. After re-reading your question though it almost sounds like you're asking if you can run a torque game server from your webserver using PHP. You can if you're allowed to do that, but if it's a webhosting package they aren't going to let you have permissions to execute a program so it won't work.