PHP change max execution time

Posted 30 March, 2009 in Other Stuff

Having trouble with your PHP scripts timing out? You need to change the max execution time. Try one or both of the following:

ini_set(“max_execution_time”, 60); // Set to 60 seconds
set_time_limit(60); // Set to 60 seconds

For no time limit try:

set_time_limit(0); // No time limit

You might still run into problems of your server is running PHP in safe mode. Also your server will have a timout that might need to be changed.

If you have access to php.ini then try changing max_execution_time to a higher value. This will however effect all your PHP scripts.

Share and Enjoy:
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • Reddit
  • StumbleUpon
  • Twitter
  • Yahoo! Buzz

Your comment: