One of the most common errors on LiteSpeed web servers is the Request Timeout error. It often happens when you are running long processes that are eventually terminated by your server and thrown as an error: This request takes too long to process, it is timed out by the server. If it should not be timed out, please contact administrator of this web site to increase ‘Connection Timeout’
What is the Request Timeout Error?
The Request Timeout error is an error message generated by the LiteSpeed web server (a faster replacement for Apache) in response to running very long scripts. The server cancels these long-running scripts (even those that use set_time_limit()) and terminates all related processes with an error. There are 2 simple ways to solve this error:
- Increase the Time Limit
- Rewriting .htaccess rules to disable the connection timeout
How to Solve the Request Timeout Error
Method 1: Increase the Time Limit
If your server times out too early, the most logical way to prevent this is by increasing the time limit. You can do this by increasing the max_execution_time in your php.ini file. By default, the time limit is set as 30s. Simply edit your php.ini file and add the following code:
max_execution_time = 300;
However, most hosting providers do not allow you to edit your php.ini file. So you can use the .htaccess or wp-config.php file to specify new limits.
For .htaccess, add the following code:
php_value max_execution_time 300
For wp-config.php, add the following code:
set_time_limit(0);
Setting the time limit as 0 in your config file removes the time limit entirely
Method 2: Disable Connection Timeout Via .htaccess
If setting the time limit does not fix the Request Timeout error, it means your server has special rules defined to override your custom settings. Therefore, we need to disable these rules. Your .htaccess file is key here.
Simply edit your .htaccess file and paste the following code:
RewriteEngine On RewriteRule .* - [E=noabort:1] RewriteRule .* - [E=noconntimeout:1]