I have a PHP script that hangs in the browser when it runs for over 200 seconds. This PHP script calls shell_exec
on a bash script and waits for output. Then, echoes that output to the browser.
Everything works fine when:
- script runs < 200 seconds
- run script from command line as localuser NOT apache
Does not work when:
- run from the browser (apache)
- run for > 200 seconds
The operations of the bash script execute fine in all cases and i can see the output when i write it to the console ... but it will just hang in the browser (no output) even after the script has "finished".
I understand that set_time_limit
will not have an effect here because system commands do not count towards script execution time.
REF: Max Execution Time and System Calls
Below is a screenshot of my Apache timeout settings. To be honest, I am unsure if that would contribute to this issue, if using shell_exec
(thus not outputting / echoing anything for some time) would have an effect on that, or what would result if an Apache timeout were to occur.
OTHER NOTES
I think it could be worth noting that after some time of leaving the script "hanging", it runs again without prompting.