Msg#: 11719 posted 3:04 pm on Feb 12, 2006 (gmt 0)
I have php and apache installed on my own local pc - making it act like a server - and need to run a php script continuously for long periods of time. This script makes constant use of a mysql database stored on my pc.
To run the script I enter [localhost...] - but after a few minutes the script times out. So I've adjusted the script so that after it has finished one iteration it does a page redirect - back to itself (so the script runs again). But after a fw minutes its times out again.
Could someone shed some light for me onto whats going on here - e.g. why it keeps stopping. Thanks.
Msg#: 11719 posted 3:19 pm on Feb 12, 2006 (gmt 0)
Probably cause your script is exceeding the "max_execution_time" which is usually 30 seconds by default. You can change this in your php.ini file. Better solution, though, might be running your script from the command line.
Msg#: 11719 posted 3:25 pm on Feb 12, 2006 (gmt 0)
No need to modify your pnp.ini just for that, you can set the max_execution_time on the fly using ini_set(). But anyway I think appache has its own time out (about 5 mins?), but as said above, becacuse it is your local pc (server), you must be able to run it from the command line with with no restrictions, the timeout restrictions apply to web sessions only as so far I know.
Msg#: 11719 posted 5:08 pm on Feb 12, 2006 (gmt 0)
I don't think re-direct will work because what you are setting there are the headers for the browser/web server, etc. In the command line you are not using the browser nor the web sever at all. Instead you may want to check into some other php functions like exec, shell_exec, etc. This doc will show you more: