tags:

views:

74

answers:

5

I'm working on a one-time PHP (5.2.6) script that migrates several million of MySQL (5.0.45) database rows to another format in another table while keeping (a lot) of relevant data in memory for incremental calculations. The data is calculated incrementally. (in chunks of about 1000 lines)

The script stops unexpectedly in random points without an error message. My question is- how can I find out whats the reason for the script stopping. (memory outage? timeout by MySQL etc...)

I have set_time_limit (0); so its not PHP timeout.

+2  A: 

see the log file, probably is memory

you need to add more memory in php.ini to memory_limit parameter

Haim Evgi
+1  A: 

You could try turning the error reporting level (in php.ini) up really high, so it complains about more things.

My first guess would have been that you hit your execution time limit or memory limit and the script was terminated, but you covered that.

rikh
set_time_limit covers the execution time limit, but not the memory limit. It's possible the memory limit is being hit.
MaxVT
+1  A: 
  • Check out your PHP log file.
  • Turn on all error reporting
    • error_reporting(E_ALL | E_STRICT);
Ólafur Waage
+1  A: 

Have you tried running the PHP from the command line rather than via a web browser? Maybe the server has something which causes it to fall over once it reaches a certain memory usage?

In general bulk operations shouldn't be done via a web server, it's liable to make them fail part way through.

MarkR
A: 

Thanks everyone for the help (I voted for the relevant answers). The issue was memory and setting ini_set('memory_limit', '200M'); solved it (it is a one time script)

Nir