Running a very long php script...
I used to work with it on my day work, but not anymore. A friend had requested me to do a clean up on a MySQL table. This table had email text imported from an inbox that to be shown in a forum site. The problem was: the emails had lots of footers with the Original Message, promotions etc and he wanted to clean up the emails before showing them on the website. The php algorithm wasn't a big deal, just detecting the strings, removing the text from that position to the end of the email and making sure the markup in the email (if it had HTML format) wouldn't break. We left this last task to Tidy.
Anyways, I had to run the final clean up script on the whole table with about 30MB of information, so I knew the script would be running for quite some time. I had no shell access on the server so I had to run the script from my browser. I had set up some output on the script so it would show what record had been updated and what was the final cleaned up text.
After making a backup of the table, I pointed my FireFox 1.7 to run the clean up script, oh my, what a pain.
First I couldn't make the script run for more than 60 seconds. I solved that with the following statement:
ini_set('max_execution_time', '0');
Then Firefox started to complain the script was too long and I should cancel it cause it was making FF to run slow and the computer might become unresponsive.
I commented out most of the echo statements and tried again, the script ran longer without the pop up window, but again FF complained :( and eventually the FF window would disappear from the task bar. It was a burden cause I wasn't able to know where the script had ended.
IE came to save my...situation :) I must confess I had stopped using IE almost completely because I kept being infected with spyware and it would download ActiveX on my back from time to time...but now the relashionship has improved considerably again :). IE never complained and ran the script a lot faster. The task was done!
2 Comments:
Kind of odd considering that PHP is parsed by the server. You'd think that the run times of the script would be independent of the browser being used...
It's not a problem of how long the script will take on each browser, as the only part showing on the browser is the echo statements, the thing is, the scripts runs for a very long time and it kind of halts Firefox, so the browser complains of a prolongued activity, IE doesn't do that, it just runs for an hour without complaining...
Post a Comment
<< Home