WordPress’s default object cache is in-memory and dies at the end of each PHP request. Every page load re-runs the same database queries for the same options, the same user meta, the same term lookups. A Redis-backed persistent object cache keeps that work across requests. On a moderately complex WordPress site, the impact is measured in 30-60% reduction of database load. On WooCommerce, more.
What’s happening
WordPress has an internal cache API (wp_cache_get, wp_cache_set). With no drop-in, it’s per-request memory. With a persistent backend (Redis, Memcached, LiteSpeed Memcached) and an object-cache.php drop-in, it persists across requests. Redis is the most common choice because it supports TLS, replication, and a richer command set than Memcached, and the WordPress drop-ins for Redis (Redis Object Cache by Till Krüss, Object Cache Pro) are mature.
How to verify
Confirm Redis is installed and running on the cPanel host:
which redis-cli
systemctl status redis 2>/dev/null
redis-cli ping
redis-cli info server | head
If Redis isn’t installed, the cPanel host operator needs to install it. On CentOS/AlmaLinux/RHEL hosts it’s dnf install redis. Make sure each cPanel user’s PHP has the redis extension or phpredis enabled — check with php -m | grep redis.
The fix
-
Install the PHP
redisextension for each PHP version you’re using:/scripts/phpextensionmgr install RedisIn MultiPHP, the extension is usually exposed as
php-pecl-redisorphp-redis. Verify per-version withea-php82 -m | grep redis. -
On a multi-tenant cPanel host, the key concern is isolation. By default Redis listens on
127.0.0.1:6379with no authentication and all clients share the same keyspace. That’s wrong on a cPanel host where multiple accounts share Redis. Fix in/etc/redis.conf:- Set
requirepass <strong-password>and distribute per-account, or - Use Unix sockets with per-account permissions (
unixsocket /var/run/redis/redis.sock,unixsocketperm 770), and put each cPanel user’s PHP-FPM group in the socket’s group.
- Set
-
Pick a database number per WordPress site so they don’t collide on key names. Redis supports databases 0-15 by default. Document the assignment in a per-server spreadsheet or runbook.
-
Install the WordPress plugin (Redis Object Cache by Till Krüss). Configure in
wp-config.php:define( 'WP_REDIS_HOST', '127.0.0.1' ); define( 'WP_REDIS_PORT', 6379 ); define( 'WP_REDIS_PASSWORD', 'strong-password' ); define( 'WP_REDIS_DATABASE', 3 ); define( 'WP_CACHE_KEY_SALT', 'example.com:' ); define( 'WP_REDIS_DISABLED', false );WP_CACHE_KEY_SALTis the defensive belt — even if two sites end up sharing a database number, their keys won’t collide. -
Enable the drop-in from the plugin’s Settings page (Object Cache). It writes
wp-content/object-cache.php. After enabling, the Settings page should show “Status: Connected.” -
Verify the cache is being used:
wp redis status redis-cli -a 'strong-password' -n 3 dbsizewp redis statusshould report Connected with a positive hit ratio after a few page loads.dbsizeshould grow as the site is browsed. -
Tune
maxmemoryandmaxmemory-policyin/etc/redis.conf. Start withmaxmemory 256mbandmaxmemory-policy allkeys-lru. On larger sites, increasemaxmemory. The LRU policy ensures Redis evicts old keys instead of refusing writes when full. -
Monitor. Add Redis to whatever monitoring the cPanel host uses. Key metrics: used memory, evicted keys per minute, connected clients, ops per second.
For environments running Redis at scale across many WordPress sites, Stack Harbor handles the operational layer as part of managed cPanel operations.
Stack Harbor operates production WordPress at scale — see enterprise WordPress hosting for the managed model, or book a WordPress consult for a written read of your current shape.