php timeout - set_time_limit(0); - don't work

user614963 picture user614963 · Aug 17, 2012 · Viewed 134.1k times · Source

I'm having a problem with my PHP file that takes more than 30 seconds to execute.

After searching, I added set_time_limit(0); at the start of the code,cbut the file still times out with a 500 error after 30 seconds.

log: PHP Fatal error:  Maximum execution time of 30 seconds exceeded in /xxx/xx/xxx.php

safe-mode : off

Answer

user1601782 picture user1601782 · Aug 17, 2012

Check the php.ini

ini_set('max_execution_time', 300); //300 seconds = 5 minutes

ini_set('max_execution_time', 0); //0=NOLIMIT