473,473 Members | 1,800 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

PHP exec hang.

2 New Member
Hello everyone, im slowly learning PHP and im strarting to kinda get the hang of the basics.
Basically, i am making a control panel for a Game Server, that can start and stop the server by running the commands './gtaserver.sh start' or './gtaserver.sh stop'.
I have 2 buttons on my control panel, Star and stop. If the server is running, the Stop button works like a dream, no problems at all and it runs through the rest of the html code in the file where i call exec('./gtaserver.sh stop');.
Pressing the Start button on the other hand, is VERY annoying. When you press it it appears that it cannot load the page and just hangs. The server starts, but the web page gives a user the impression that it hasnt and they might press the button again. As it hangs, it also stops the rest of the html code (a redirect) working in the file where i call exec('./gtaserver.sh start');.
I have tried things like './gtaserver start\n echo started' That fixes the html code not running problem, but the server doesnt start.

Any help on this is greatly apprecieated.

Thanks,
DragSta

PS:
Server info:
Redhat Linux Fedora 6
Apache version 2.2.3
1 gb ram
Mar 17 '08 #1
2 3031
TheServant
1,168 Recognized Expert Top Contributor
What about having a delayed refresh of the page? So you execute the server start and on the next line give a 5 second delayed refresh. That way the serve has time to wake up before it has requests?
Mar 18 '08 #2
DragSta
2 New Member
What about having a delayed refresh of the page? So you execute the server start and on the next line give a 5 second delayed refresh. That way the serve has time to wake up before it has requests?
Thanks for the help, but i fixed it anyway. I used popen instead of exec. Works like a dream :D

Heres the code i used:
Expand|Select|Wrap|Line Numbers
  1. $fp=popen("./gtaserver start","r");
Mar 18 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Matt | last post by:
I want have PHP call another process (another PHP script at the moment but it may end up being a binary) in the background and not wait for process to complete, but rather instantly jump the the...
0
by: Dmitry Pljonkin | last post by:
Hi! I have some troubles trying to start php script using exec() and leave it running in the background. Manual says: "If you start a program using this function and want to leave it running...
1
by: Andr? Roberge | last post by:
I have the following two files: #--testexec.py-- def exec_code(co): try: exec co except: print "error" #-- test.py--
0
by: Jan | last post by:
I store sql-commands in a database table. In the first step I get the sql command out of the database table with embedded sql. In the second step I try to execute the command, which i got from the...
4
by: Madhu Gopinathan | last post by:
Hi All, I am faced with a horrible hang problem. I have a COM exe server that executes some tasks. The task execution manager is a thread that manages the pool of threads, which is 4 per processor....
1
by: Gunnar G | last post by:
If I wish to run an external application with exec(), does the execution of the PHP script halt until the external application has finished?
26
by: warth33 | last post by:
Hello I have a php site. Some page needs to call an external program. The programs are home made c# applications. It uses to work without problem. For a while. Maybe it work for some hour....
3
by: Fiddler2 | last post by:
I noticed that after running compact/repair, I have to recompile my code for the program not to break the next time I open it. What happens is the auto exec macro runs the main() module, then hangs...
5
by: Ron Ford | last post by:
I thought I would ask a question that is decidedly non-political, although I will admit that a frenchman made my fourth. As well as infinite cheeseburgers, and, of course, jenny. When I believe...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.