0

I have a php page that runs a number of loops and queries and database updates etc. It can take some time to run and after a minute, I get the 500 Internal Server Error. I don't have access to the logs but my hosting service has forwarded a copy and it seems that it is a timeout related error:

mod_fcgid: read data timeout in 60 seconds

I have included:

ini_set('max_execution_time', 9000);
set_time_limit(0);

In the php page but it still causes the 500 error. I can't access any of the config files. Is there any other way I can increase the timeout for this page?

I have also tried putting

set_time_limit(59);

at the start of each loop through. If this is meant to reset the clock then I can't see that I should have a problem but the error persists.

NOTE: I am 99% sure that it is not an error in the script itself as sometimes it goes through and other times times it doesn't with exactly the same data.

RGriffiths
  • 5,722
  • 18
  • 72
  • 120
  • You can use the set_time_limit() to reset the time limit – Answers_Seeker Dec 28 '15 at 12:25
  • @Harikrishnan max_execution_time = 60 seconds (i.e. my error) and I am not sure what time_limit you are referring to. – RGriffiths Dec 28 '15 at 12:28
  • @Answers_Seeker I have included that in my question. Setting it at 0 should mean that there is no limit (as I understand it). – RGriffiths Dec 28 '15 at 12:28
  • Right, i was thinking about the [reseting behavior](http://php.net/manual/en/function.set-time-limit.php) which could do the trick – Answers_Seeker Dec 28 '15 at 12:29
  • @Answers_Seeker Oh I see. I have added an edit to include this. It is still struggling. – RGriffiths Dec 28 '15 at 12:36
  • 1
    Just check values are set correctly by `ini_get('max_execution_time')` – Harikrishnan Dec 28 '15 at 12:44
  • 1
    @Harikrishnan Very helpful. Been playing with that and although ini_set('max_execution_time', 9000); was written at the beginning it didn't seem to be being applied. Moved it lower down into the page and it worked. Thanks!! – RGriffiths Dec 28 '15 at 13:24

0 Answers0