Affiliate Marketing
Forum Search

Reply
 
LinkBack Thread Tools Display Modes

  #1 (permalink)  
Old 23-12-04
morleymouse's Avatar
Super Member
 
Join Date: Aug 2003
Location: Costa Del Sheffield
Posts: 2,744
Thanks: 1
Thanked 10 Times in 6 Posts
morleymouse is an unknown quantity at this point
  php, stop take a break

sorry, I do try and make thread titles as descriptive as possible honest

So my php script goes and collects a load of feeds and throws them all int oa database for stuff.

Only thing is now there are a few big ones in there its taking some time so im getting this:

Fatal error: Maximum execution time of 30 seconds exceeded in /home/me/public_html/directory/my_php_script.php on line 83

I presume this is something set up on the host so that scripts cant just run forever and I duno damage the server or something.

Anyway, as I dont think I can alter this, without emailing and pleeding

If there anyway to make the script just like stop, or pause for a bit inbetween feeds so that I dont get this error?

Or do I have to split the script up and do the feeds in like 2's?

Merry Christmas
__________________
Dan Morley
Alpharooms.com
daniel at alpharooms dot com - Hotels, Flights, Airport Transfers, Care Hire + More! sign up
My Blog | Cheap Holidays
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 23-12-04
morleymouse's Avatar
Super Member
 
Join Date: Aug 2003
Location: Costa Del Sheffield
Posts: 2,744
Thanks: 1
Thanked 10 Times in 6 Posts
morleymouse is an unknown quantity at this point
all is well,

set_time_limit(0);

fixes it
__________________
Dan Morley
Alpharooms.com
daniel at alpharooms dot com - Hotels, Flights, Airport Transfers, Care Hire + More! sign up
My Blog | Cheap Holidays
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 23-12-04
Super Moderator
 
Join Date: Aug 2003
Posts: 2,451
Thanks: 0
Thanked 0 Times in 0 Posts
Rich is an unknown quantity at this point
To make it pause for a bit add a line like: -
sleep(5);

to make it pause for 5 seconds, this is always a good idea to save hosts resources on long jobs that arn't time critical.

But that won't get you past the 30 second time out to get past that the safest way is to reset the counter between each feed by adding a line like: -
set_time_limit(30);

This resets the time limit at that point, so what you want to do is

// get feed 1
sleep(5);
set_time_limit(30);
// get feed 2
sleep(5);
set_time_limit(30);
// get feed 3
etc

This means that each feed has got 25 seconds to process (30-5) and if any feed gets stuck in loop the script will still time out. The other option is to use set_time_limit(0); which totally turns off the time limit, but don't expect your hosts to be happy if you accidently set of a script that gets stuck in a loop as it will run forever.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 23-12-04
morleymouse's Avatar
Super Member
 
Join Date: Aug 2003
Location: Costa Del Sheffield
Posts: 2,744
Thanks: 1
Thanked 10 Times in 6 Posts
morleymouse is an unknown quantity at this point
apparently im in safe mode, so I cant do set_time_limit(0); <that

hm, ill try the

set_time_limit(25);

at end of feeds, but if im not allowed to set_time_limit(0); I dont think other will work, any other ideas?
__________________
Dan Morley
Alpharooms.com
daniel at alpharooms dot com - Hotels, Flights, Airport Transfers, Care Hire + More! sign up
My Blog | Cheap Holidays
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 23-12-04
andy2004's Avatar
Registered User
 
Join Date: Mar 2004
Posts: 132
Thanks: 0
Thanked 0 Times in 0 Posts
andy2004 is an unknown quantity at this point
could you add this line to .htaccess file?

php_value max_execution_time 30
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 24-12-04
morleymouse's Avatar
Super Member
 
Join Date: Aug 2003
Location: Costa Del Sheffield
Posts: 2,744
Thanks: 1
Thanked 10 Times in 6 Posts
morleymouse is an unknown quantity at this point
cool that works! cheers, put the time up to 100 secs and it has a 5 sec kip after every feed, just to save them thar resources

merry christmas!
__________________
Dan Morley
Alpharooms.com
daniel at alpharooms dot com - Hotels, Flights, Airport Transfers, Care Hire + More! sign up
My Blog | Cheap Holidays
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Affiliate Marketing RSS Feeds - Contact Us - Affiliate Marketing - Archive - Privacy Statement - Top

Content Relevant URLs by vBSEO 3.2.0 RC7