Speeding Up OpenCart with Redis on a Plesk Server
June 27, 2025Recently, I decided to improve the performance of an OpenCart store by switching the caching engine to Redis. It turned out to be a worthwhile upgrade, but not without a few hurdles along the way.
Why Redis?
Redis is an in-memory data store often used for caching. It offers fast read/write performance, which helps make OpenCart faster and more scalable, especially for stores with lots of products or traffic.
Installing Redis on a Plesk Server
On a CentOS/RHEL-based server with Plesk, I installed Redis using yum
:
yum install redis
After installation, I enabled and started the Redis service:
systemctl enable redis
systemctl start redis
Confirmed it’s running:
systemctl status redis
You may also need the PHP Redis extension (in my case it was already installed for PHP 8.1):
yum install php-pecl-redis
Then restart your web server and PHP:
systemctl restart httpd # For Apache
systemctl restart nginx # If you're using Nginx
systemctl restart php-fpm # Replace with your actual PHP-FPM version
Configuring OpenCart to Use Redis
Next, I told OpenCart to use Redis for caching.
Opened the following file:
system/config/default.php
Find this line:
$_['cache_engine'] = 'file'; // apc, file, mem or memcached
Change it to:
$_['cache_engine'] = 'redis'; // apc, file, mem or memcached
In addition, I had to define the Redis host, port, and prefix. Add the following lines to both of your configuration files:
config.php
(main store)admin/config.php
(admin panel)
define('CACHE_HOSTNAME', '127.0.0.1');
define('CACHE_PORT', '6379');
define('CACHE_PREFIX', 'oc_');
Make sure the IP matches the internal Docker/bridge IP if you’re using containers, or 127.0.0.1
if Redis is local and accessible that way.
Solving an Issue: Redis Process Killed by lfd
After everything seemed fine, Redis would mysteriously stop after a few minutes. Logs showed that lfd (Login Failure Daemon) was killing it, mistaking Redis for a suspicious or abusive process.
Solution: Add Redis to the lfd Ignore List
To fix this, I needed to whitelist Redis in csf
:
-
Edited the process ignore file:
nano /etc/csf/csf.pignore
-
Added this line:
exe:/usr/bin/redis-server
-
Restarted CSF and lfd:
csf -r systemctl restart lfd
This prevented lfd
from killing Redis, and it’s been running reliably since.
Switching to Redis gave this OpenCart store a noticeable speed boost. The process was mostly straightforward, but required some tweaking to ensure stability on a Plesk server especially around lfd
behavior and the need to define the cache host and port explicitly.
If you’re looking to improve OpenCart performance and you’re comfortable with server-side changes, Redis is definitely worth trying.