0

I am designing an web app which should generate more than 10000 entries at a time. All code works fine but I got an error as server timed out after 2-3 minutes of execution. At the top of the page I mentioned

ini_set('max_execution_time', 0);

as set to 0 = infinity but still page execution stops after 2-3 minutes. Is there any solution for this? Please help.

Thanks in advance.

2 Answers2

0

There are many places to timeout:

  • PHP scripts via :
  • max_execution_time ini setting, already covered
  • set_time_limit() which is basically the same as above
  • max_input_time which defaults to infinity so this likely isn't the issue
  • Client timeouts, which may be different depending on the browser (often default to somewhere between 2 and 5 minutes), or may be modified in JavaScript, on the XMLHttpRequest object for example.
  • Some sort of middleware specific to your configuration, perhaps a configuration parameter in a reverse proxy like nginx or apache, or some sort of FastCGI setting.

Good luck finding it.

ADJenks
  • 2,973
  • 27
  • 38
-1

First, you need to check that Is your server run your site in safe mode or not because You can not change this setting with ini_set() when running in safe mode. Many hosts run in safe mode so better to check first.

max_execution_time only limits the script execution time of itself i.e. CPU time of your script.

In case if you do with set_time_limit() then the same restriction is in place on set_time_limit().

set_time_limit() is indeed just a convenience wrapper around the according ini_set() call. You can check difference between them here.

Second, after set time limit then you should also set the memory limit with ini_set('memory_limit','32M'); . memory unit depends upon your requirement.

Using this condition you can check that Is your limit function effects value or not

echo 'Time Limit = ' . ini_get('max_execution_time') .

So better to check result with changes. This way you can check, Is your changes working or not, if not then you need to consult with support

Community
  • 1
  • 1
Deep Kakkar
  • 5,831
  • 4
  • 39
  • 75