16th Nov 2013 04:29pm
2,305 views | 0 comments

Maximum Execution Time

I was working on some PHP stuff last night and decided to use the Phirehose library and when running one of the scripts, I kept getting this error:

Fatal error: Maximum execution time of 30 seconds exceeded in C:\php\libs\phirehose\Phirehose.php on line 587

Now it obviously doesn't take a genius to understand the meaning of the error, for those that don't understand, basically in the settings of my PHP setup I have told it that if any script takes more than 30 seconds to complete, then time out... and that's basically what's happened here. So how do I fix it?

Well, a lot of folk around the internet world will say change the execution time to 0, for example placing this at the top of the main Phirehose.php file:


However, this will use a lot more resources and also not exactly fix the usual problem of the reason as to why it's timing out.

The easiest way to solve this problem is to NOT execute your script through the browser as this will cause an infinite loop (which is the reason the script is timing out as it's caught in a loop that it can't get out of) and execute it through a command line script, so in my case:

php get_tweets.php

This will then run nicely and not cause any execution errors. :) (If you do get any errors on the Command Line script, then make sure you've navigated to the directory where your script is stored)

So, all-in-all, DON'T use your browser, DO use command line.



Tweet ThisShare On FacebookAdd To Del.icio.usShare On RedditShare On LinkedIn



Post your comment...

Your Name:

Your Email:

Your Comment:

Are You Human?

Tick this box to confirm you're not a bot.

  • © Dale Hay, 2005 - 2020