I am using PHP system() calls to run third party software. This software dumps output which is then forwarded to the browser synchronously. If the user hits the browser STOP button at the wrong time everything hangs, and all subsequent requests from that name-based virtual server (Apache) do not respond until the web server is restarted. Other virtual servers continue to work normally. Although a mySQL connection is involved, I do not think this is the problem as I can force closure of any open threads and the problem is not solved. I cannot, however, force closure of the process spawned by the system() call with Admin privs (on Windows 2003).
Can anyone:
(a) Tell me what they think is happening here; or
(b) Suggest a quick fix way to fix this without requiring restart
Thanks for you help.
Hang on browser stop button in middle of system() call
Moderator: General Moderators
Re: Hang on browser stop button in middle of system() call
My immediate guess would be the culprit is the 3rd party software, or maybe IIS.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
Re: Hang on browser stop button in middle of system() call
A quick fix:
at the top of the page.
A real fix might be a Linux server
Code: Select all
ignore_user_abort();
set_time_limit(0);A real fix might be a Linux server
There are 10 types of people in this world, those who understand binary and those who don't
Re: Hang on browser stop button in middle of system() call
Yes--linux would be nice, however box needs to run Windows 2003. Apache/PHP instead of IIS are consolation prizes.
I tried ignore_user_abort() and set_time_limit(). Thank you for these suggestions. However this does not solve the problem. I also tried setting max_execution_time in configuration to 10 seconds, and it still does not recover after 10 seconds. Full Apache shutdown still required.
If it is the third-party software (happens to be R - statistical software interpreter) that is hanging, then how can I uncouple PHP (or is it Apache?) from hanging with it.
I am using system() calls rather than passthru() because I need R to send stuff to the browser synchronously. It is running long analyses, and it reports on its progress as it goes. passthru() only reports upon completion of the spawned process, it seems.
Thanks
I tried ignore_user_abort() and set_time_limit(). Thank you for these suggestions. However this does not solve the problem. I also tried setting max_execution_time in configuration to 10 seconds, and it still does not recover after 10 seconds. Full Apache shutdown still required.
If it is the third-party software (happens to be R - statistical software interpreter) that is hanging, then how can I uncouple PHP (or is it Apache?) from hanging with it.
I am using system() calls rather than passthru() because I need R to send stuff to the browser synchronously. It is running long analyses, and it reports on its progress as it goes. passthru() only reports upon completion of the spawned process, it seems.
Thanks
Re: Hang on browser stop button in middle of system() call
Another possibility--could it be related to the fact that output buffering is _not_ being used in order that output from the third-party software is sent in real-time.