Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

How to stop a command line PHP script from timeing out? WordPress

This is a PHP question, not really a WordPress question.

Last year I wrote a command line script for a client. I was in a hurry so I used PHP. The idea was to import data from their old database to their new database, making some transformations along the way. They had a few gigs of data. The script took 17 hours to run, but it ran.

Now they have over 100 gigs of data that they need to transfer with the same script. My sense is that the script needs to be re-written at a multi-threaded Java app, but I don't have the time.

They ran the script this week. It ran for 3 days and then timed out without completing. They asked me for help. When I have time I plan to re-write the script as a small Clojure app. But for now, I am looking for a quick fix.

I suspect that after 3 or 4 days the script temporarily lost the database connection, and then was not able to continue. I'm trying to think about how to get around that possiblity. I'm thinking there might be something clever I can do with exceptions? Wrap it all in a try/catch block?

Any suggestions?

Answers (0)

No answers yet.