PHp MySQL - running a long script - how to prevent timeout?
Posted on 2009-02-17
I've written some PHPfunciton which opens a lot of database connections. The code contains a lot of legacy code so it is difficut to change much of its working.
The code processes some cusotmer information and takes a good few moments to run. All works well if I run it on a few customers although it does take some time (say about 3 mins for 100 customers).
In fact it's fine when I even run it on up to about 500 customers. But we have to run it on about 50000 customers or any amount above 1000, the Internext explorer window just never completes or even times out. It just shows the whirling circle indefinetely.
It effectively never completey loads the page but I assume at some point the server times out as it does not process all of the customes correctly.
How can I approach this so there are intervals that allow the script to catch up with itself and perhaps provide screen output during the process to update me as to how far it has got.
I did put an echo into the main loop but it does not seem to actually print the output until it has completed the entire script. (so when I run it on a small amount of customers when it completes all of a sudden it dumps the output onto the screen in one go).
Thanks for any input on this matter.