[SOLVED] - Maximum execution time of 30 seconds exceeded

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
anjanesh
DevNet Resident
Posts: 1679
Joined: Sat Dec 06, 2003 9:52 pm
Location: Mumbai, India

[SOLVED] - Maximum execution time of 30 seconds exceeded

Post by anjanesh »

There is the html file that Im loading :

Code: Select all

$lines=file("somwhere.com/somepage.html");
But it very often (98%) shows the error :
Fatal error: Maximum execution time of 30 seconds exceeded in C:\xxx\xxx.php on line nn
This is probably because of my slow net connection (64kbps) - I've to try it on my host.
But is there a better alternative ? Do most web hosts set their max execution time to 30s or it'll be real fast to load this ?
Thanks
Last edited by anjanesh on Sat Mar 12, 2005 9:30 am, edited 1 time in total.
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

php.net wrote:set_time_limit -- Limits the maximum execution time
Description
void set_time_limit ( int seconds)


Set the number of seconds a script is allowed to run. If this is reached, the script returns a fatal error. The default limit is 30 seconds or, if it exists, the max_execution_time value defined in the php.ini. If seconds is set to zero, no time limit is imposed.

Code: Select all

set_time_limit(0);
User avatar
Buddha443556
Forum Regular
Posts: 873
Joined: Fri Mar 19, 2004 1:51 pm

Post by Buddha443556 »

Is this something you could setup as a cron job to fetch? I suggest this because PHP isn't the only timeout. Servers have timeouts too usually at 300 seconds. You could find yourself with requests piling up before 5 minute server timeout kills them.

The default timeout for PHP is 30 seconds. I never seen a host change that default yet. Some hosts don't allow_url_fopen though.
User avatar
anjanesh
DevNet Resident
Posts: 1679
Joined: Sat Dec 06, 2003 9:52 pm
Location: Mumbai, India

Post by anjanesh »

Buddha443556 wrote:Is this something you could setup as a cron job to fetch? I suggest this because PHP isn't the only timeout.
No. This is some content taken from a site (html file) as they dont provide RSS Feeds. I had to extract a small portion of it but the page was big and I had to parse the entire thing.
Thanks for your help.
Post Reply