Jump to content

Script timeout


knutsford

Recommended Posts

 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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.  

Link to comment
Share on other sites

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

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.