
LiteSpeed and Redis Optimization
We would like to inform you about the possibility of greatly optimizing the performance of your WordPress websites hosted on the DirectAdmin platform, provided you have any of our DirectAdmin hosting packages.
For WordPress, there are two plugins that significantly help with caching, loading speed, and overall web and database performance.
1. Web Caching: LiteSpeed Cache
For web caching, we highly recommend the LiteSpeed Cache plugin. You can download it from the following address: LiteSpeed Cache Plugin
Simply download, install, and activate this plugin.
2. Database Caching: Redis Cache
For database caching, we recommend the Redis Cache plugin: Redis Cache Plugin
Since this plugin requires an activation process, please follow the steps below:
- Download and install the plugin in WordPress.
- Log into your DirectAdmin panel, navigate to Advanced Features -> Redis, and click Enable. Then, copy/note down the Path to Redis Socket File.
- Open your
wp-config.phpfile using File Manager or FTP and add the following lines:
PHP
define( 'WP_CACHE', true );
define( 'WP_REDIS_SCHEME', 'unix' );
define( 'WP_REDIS_PATH', '/home/USERNAME/.redis/redis.sock' );
⚠️ WARNING: You must replace
USERNAMEwith your actual DirectAdmin username (refer to the path you copied during the Redis activation step above).
- Go back to your WordPress admin dashboard, navigate to the Redis plugin settings, and activate it.
Please check the official information for implementation.
Multiple PHP Versions on the Same Account
To use a different PHP version than the one globally set on your DirectAdmin account, add the following directive to your .htaccess file:
Apache
<FilesMatch "\.(php4|php5|php3|php2|php|phtml)$">
SetHandler application/x-lsphpXX
</FilesMatch>
Replace phpXX with your desired version (e.g., php56, php74, php82, etc.).
Eliminating Timeouts via .htaccess
If you need to run scripts that take longer than 120 seconds and do not send data to the browser during execution—which is typically what triggers a timeout—you must add the code below to the very top lines of your .htaccess file:
Apache
<IfModule Litespeed>
RewriteEngine On
RewriteRule .* - [E=noabort:1, E=noconntimeout:1]
</IfModule>
To test whether the code has been entered correctly and is functioning, you can use the PHP script available here: LiteSpeed Long Run Script Documentation.
If the test runs successfully but your specific script continues to time out, you will need to debug your script to find exactly where the stall occurs. Please note that regardless of the script type—whether custom-built or open-source—debugging is strictly the client’s responsibility.
⚠️ IMPORTANT ATTENTION! Do not leave this code in your main
.htaccessfile after completing the specific task that required the extended timeout. Keeping it active can cause serious performance and access issues during standard site operations. This configuration is intended strictly as a maintenance tool.
Complete details can be found at this address: LiteSpeed Official Docs.
💡 Tip: You can choose to insert and keep this code inside the .htaccess file located specifically within your admin or wp-admin folder. This restricts the setting exclusively to that folder, allowing you to run necessary administrative queries indefinitely without experiencing timeouts.
