Jump to content

Archived

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

johnsmith153

ini_set('max_execution_time', $whatIsTheLimit);

Recommended Posts

What is the maximum number of seconds I can apply to 'max_execution_time' ?

 

I think if I put something silly like 999999 it may just reset to a low default.

 

I need a high limit for a task that requires access to a Web Service API that takes up a lot of server time.

Share this post


Link to post
Share on other sites

max_execution_time is an integer, so the maximum value that you can set is 2147483647 seconds (over 68 years) on a 32-bit system (i.e 2^31, with the msb reserved for the sign). The alternative is to set the value to 0, which means that the script will never time out.

Of course, if you're running you script through the web server, as a CGI script, then the web server is also likely to have its own timeout.

 

The set_time_limit function allows you to override this value, and dynamically extend the time-out period one or more times during script execution; though it's still constrained by the web server timeout.

Share this post


Link to post
Share on other sites

so can the web server overide this new set time out in the script?

The web server does override the PHP limit. The web server will send an appropriate response to the client browser when it times out, if PHP has not finished executing.

 

I can't recall what the Apache config parameter is off the top of my head, but it's likely to be in the httpd.conf file.

 

However, Apache default is something like 300 seconds (5 minutes). Most people would abort a page if they hadn't had a response in this time. So you also need to determine what should happen if the user aborts their transaction, or closes their browser window because they're fed up waiting to see a response.

 

Share this post


Link to post
Share on other sites

ini_set('max_execution_time', -1);

 

:P Duh.

 

Share this post


Link to post
Share on other sites

×
×
  • 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.