Support » Plugins » Hacks » Maximum execution time in WP – can this be bumped up or down?

  • As I understand it there is in “WP a request time out”, which has a standard setting of 5 seconds.
    Is this a limit on the duration of making a request only, or does it include also the time taken by any back-end processes that service the request?
    If that is not the case what is the limit execution process on the back-end? Also, what relationship has this got with the PHP Maximum_execution_time, which appears to be generally standardized to 30 seconds?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator bcworkz


    5 seconds sounds like the Apache keep alive timeout. WP doesn’t manage this in any way, it is determined in the server configuration file. It cannot be overridden in .htaccess, so unless your host allows you to edit the configuration file, you are stuck with what it is.

    According to Apache docs, the keep alive timeout is “The number of seconds Apache httpd will wait for a subsequent request before closing the connection.” Keeping the connection open allows for more efficient communications, but setting it too long can overload a busy server.

    This has nothing to do with PHP execution time, it’s an HTTP metric.

    1. So okay, I get the part about the duration of the http connection.
    2. Now what about the max time that WP will allow my back-end process to take? Am I then right in understanding that this is driven entirely by whatever the settings are on my host’s server for the Max_Execution_time in either or both of php.ini and Apache’s .htaccess file? WP just passes these on, so to speak?

    Moderator bcworkz


    Yes, WP does not attempt to manipulate these metrics by default. Some PHP metrics can be manipulated by theme or plugin. The keep alive time out is not one of these that can be manipulated, but it sounds like you are actually interested in the PHP max. execution time. This defaults to 30 sec. in most installations. It can be altered in the php.ini file, but can also be changed (usually) at run time with set_time_limit( $time ); where $time is in seconds. Unless you have reasons otherwise, a good place to set the time limit is wp-config.php since it is one of the first files to load and it is the only core file you should edit.

    Changing the time limit can be useful for major WP updates. I’ve found the update can sometimes take longer than the allotted 30 sec.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Maximum execution time in WP – can this be bumped up or down?’ is closed to new replies.