How do I disable LiteSpeed connection timeouts?
LiteSpeed web server is utilised on our hosting accounts for its improved security, performance, and stability. However, certain PHP scripts may need to run for extended periods without interruption. Examples include WordPress modules such as BackupBuddy, ImportBuddy, or any other module that relies on a WordPress built-in cron job. Additionally, whenever a PHP application rebuilds MySQL indexes, the process may take a long time to complete. Disabling LiteSpeed connection timeouts can be essential in these cases.
To allow your PHP scripts to run without timeouts, follow these steps to modify your website's .htaccess file:
Log in to cPanel:
Access your cPanel account.
Open File Manager:
Navigate to the File Manager tool in cPanel.
Enable Viewing Hidden Files:
Before proceeding, ensure that hidden files are visible. You can do this by clicking on Settings in the top-right corner of the File Manager and checking the box for Show Hidden Files (dotfiles).
Locate the .htaccess File:
In the public_html directory (or the root directory of your website), find the .htaccess file. If it doesn’t exist, you can create a new one.
Edit the .htaccess File:
Right-click on the .htaccess file and select Edit. If prompted, choose Edit again in the code editor.
Add the Following Lines:
Save Changes:
After adding the lines, click Save Changes in the top-right corner and close the editor.
The above rules would apply to all requests, for wp-cron.php, backupbuddy.php, and importbuddy.php only the following can be used:
Steps to Disable LiteSpeed Connection Timeouts via cPanel File Manager
To allow your PHP scripts to run without timeouts, follow these steps to modify your website's .htaccess file:
Log in to cPanel:
Access your cPanel account.
Open File Manager:
Navigate to the File Manager tool in cPanel.
Enable Viewing Hidden Files:
Before proceeding, ensure that hidden files are visible. You can do this by clicking on Settings in the top-right corner of the File Manager and checking the box for Show Hidden Files (dotfiles).
Locate the .htaccess File:
In the public_html directory (or the root directory of your website), find the .htaccess file. If it doesn’t exist, you can create a new one.
Edit the .htaccess File:
Right-click on the .htaccess file and select Edit. If prompted, choose Edit again in the code editor.
Add the Following Lines:
RewriteEngine On
RewriteRule .* - [E=noabort:1]
RewriteRule .* - [E=noconntimeout:1]
Save Changes:
After adding the lines, click Save Changes in the top-right corner and close the editor.
The above rules would apply to all requests, for wp-cron.php, backupbuddy.php, and importbuddy.php only the following can be used:
RewriteEngine On
RewriteRule (wp-cron|backupbuddy|importbuddy)\.php - [E=noabort:1]
Updated on: 21/10/2024
Thank you!