PHP Fatal error: Maximum execution time of 0 seconds exceeded

Posted on: 09 December 2011

I've got a pretty long-running script. In our live environment this runs under command line PHP, but for convenience on my dev machine I just run it through Apache.

Initially I got an error

Fatal error: Maximum execution time of 30 seconds exceeded

No problem - just up the max_execution_time parameter to zero in my php.ini to give an infinite execution time, restart Apache, and start again. Trouble was, after about ten minutes, I got a slightly different error:

Fatal error: Maximum execution time of 0 seconds exceeded

Hang on - zero is supposed to be infinite!

A bit more digging reveals that this is in fact an incorrect error message, and it's a different setting which has been exceeded - max_input_time. Setting this to -1 (why is this -1 for unlimited, while max_execution_time is 0 for unlimited? Answers on a postcard...) sorted me out. Thanks to Jason Hinkle for pointing the way on that one...