Jump to content


Photo

Script timeout


  • Please log in to reply
7 replies to this topic

#1 knutsford

knutsford
  • New Members
  • Pip
  • Newbie
  • 4 posts

Posted 11 October 2017 - 05:01 PM

 I have a script that is loading down properties but it is timing out by the look of it. How do I stop it from timing out in PHP 5.6 please?

 

 

set_time_limit(0);
ini_set('max_execution_time', 0);
ini_set('memory_limit', '-1');

 

Doesn't seem to make any difference

Thanks



#2 Barand

Barand
  • Moderators
  • Sen . ( ile || sei )
  • 17,734 posts

Posted 11 October 2017 - 06:07 PM

I think your problem is on line 26.
If you are still using mysql_ functions, STOP! Use mysqli_ or PDO. The longer you leave it the more you will have to rewrite.

Donations gratefully received






moon.png

|baaGrid| easy data tables - and more
|baaChart| easy line, column and pie charts

#3 knutsford

knutsford
  • New Members
  • Pip
  • Newbie
  • 4 posts

Posted 12 October 2017 - 07:11 AM

Is that supposed to be a serious answer?

 

All I want to know is what is the  php 5.6. equivalent of

 

set_time_limit(0);
ini_set('max_execution_time', 0);
ini_set('memory_limit', '-1');



#4 Barand

Barand
  • Moderators
  • Sen . ( ile || sei )
  • 17,734 posts

Posted 12 October 2017 - 07:40 AM

Is that supposed to be a serious


No, but with so little information we have no option but to guess.

If I were you I would look for the cause and not for ways to allow it to run forever.
If you are still using mysql_ functions, STOP! Use mysqli_ or PDO. The longer you leave it the more you will have to rewrite.

Donations gratefully received






moon.png

|baaGrid| easy data tables - and more
|baaChart| easy line, column and pie charts

#5 knutsford

knutsford
  • New Members
  • Pip
  • Newbie
  • 4 posts

Posted 12 October 2017 - 03:56 PM

The cause is that is is looping through over 100 properties in an xml file.

I have tried flushing the buffer within the loop to stop the timeout but that isn't working. None of my echo's in the loop are appearing on the screen



#6 kicken

kicken
  • Gurus
  • Wiser? Not exactly.
  • 3,289 posts
  • LocationBonita, FL

Posted 12 October 2017 - 06:22 PM

What are you doing inside the loop? Looping over 100 items would take almost no time at all.

Disabling the script's time limit is almost always the wrong solution, and depending on the setup may not even work. For instance a hosting provider may kill a script that runs too long and that'd be entirely out of your control.

You need to re-design your script so it can execute within the time limit and/or break up the work across multiple runs.
Recycle your old CD's, don't trash them!
Did I help you out? Feeling generous? I accept tips via Bitcoin @ 14mDxaob8Jgdg52scDbvf3uaeR61tB2yC7

#7 gizmola

gizmola
  • Administrators
  • Advanced Member
  • 4,593 posts
  • LocationLos Angeles, CA USA

Posted 12 October 2017 - 07:29 PM

The default timeout for a php script is 30 seconds.   That is a long time.  Is this script batch/conversion oriented?  If you are running it with command line php (php -f) then it is frequently the case that php is configured with a different php.ini than the one that is used by the webserver setup, if you are using Apache.  This would explain why your setting changes are not being reflected.  If you are running this through a web server via a url, then I also have to warn that any changes you make will not be reflected without a restart of apache.

 

The fact that I have to ask you these questions should help you understand that your question is missing vital information needed in order to help you.  



#8 knutsford

knutsford
  • New Members
  • Pip
  • Newbie
  • 4 posts

Posted 13 October 2017 - 11:48 AM

Thanks. I have gone through the code and manged to speed it up a bit. It is definitively doing more before collapsing in a heap. I think the main problem that is taking the time up is resizing and storing umpteen images per Property. As many as 9 or 10 in some cases. I am going to ask if he needs that many






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users