knutsford Posted October 11, 2017 Share Posted October 11, 2017 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 More sharing options...
Barand Posted October 11, 2017 Share Posted October 11, 2017 I think your problem is on line 26. Link to comment Share on other sites More sharing options...
knutsford Posted October 12, 2017 Author Share Posted October 12, 2017 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'); Link to comment Share on other sites More sharing options...
Barand Posted October 12, 2017 Share Posted October 12, 2017 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. Link to comment Share on other sites More sharing options...
knutsford Posted October 12, 2017 Author Share Posted October 12, 2017 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 Link to comment Share on other sites More sharing options...
kicken Posted October 12, 2017 Share Posted October 12, 2017 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 More sharing options...
gizmola Posted October 12, 2017 Share Posted October 12, 2017 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 More sharing options...
knutsford Posted October 13, 2017 Author Share Posted October 13, 2017 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 More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.