A Redis object cache keeps the results of WordPress’s repeated database queries in memory, so wp-admin, logged-in users and WooCommerce pages respond faster. On Hostinger, Redis is only available on a VPS. This guide installs Redis and its PHP extension on a Hostinger VPS, connects WordPress with the Redis Object Cache plugin, and shows how to confirm cache hits.
Quick answer: On a Hostinger VPS, install redis-server and php-redis, add the Redis settings to wp-config.php, then enable the Redis Object Cache plugin. On Web or Cloud hosting plans, use hPanel’s Object Cache option instead, because Redis isn’t offered there.
- Over SSH, install
redis-serverandphp-redisand check thatredis-cli pinganswersPONG. - Restart PHP-FPM so PHP loads the Redis extension.
- Add the host, port, timeouts and a unique
WP_CACHE_KEY_SALTtowp-config.php. - Install the Redis Object Cache plugin and run
wp redis enable. - Run
wp redis statusand watchredis-cli monitorwhile you load pages.
In this guide
- Before You Start
- What Redis Caches in WordPress
- Step 1: Install Redis and the PHP Extension on Your VPS
- Step 2: Add the Redis Settings and a Key Salt to wp-config.php
- Step 3: Install and Enable the Redis Object Cache Plugin
- Step 4: Confirm Cache Hits and Check Redis Memory
- Step 5: Exclude Short-Lived Cache Groups (Optional)
- If Redis Shows “Disconnected” or Errors
- Frequently Asked Questions
- Next Steps
Full-page caching (LiteSpeed Cache or Nginx FastCGI cache) works well for logged-out visitors reading posts, but it skips dynamic requests. When you edit a post, manage WooCommerce orders or run a search, the page cache does nothing. That is where a persistent object cache helps.

Before You Start
Check which Hostinger product you are on first. According to Hostinger’s documentation, Redis is not available on its Web and Cloud hosting plans; those plans offer an Object Cache option in hPanel instead, powered by LiteSpeed Memcached and the LiteSpeed Cache plugin. To run Redis yourself, you need a VPS:
- A Hostinger VPS (or any server where you have root access) running Ubuntu or Debian.
- PHP 8.1+ with the PhpRedis extension (the
php-redispackage). - Root or sudo SSH access, plus WP-CLI for the commands below.
Also plan for:
- Time: about 20–30 minutes.
- Backup: back up the site and
wp-config.phpbefore Step 2. A typo inwp-config.phptakes the site down, and restoring the copy undoes it. The guide to automate WordPress backups with WP-CLI and cron shows a script you can run on the VPS too. - Live stores: on a busy WooCommerce site, make the change at a quiet time, or on a copy of the site first, so active checkouts aren’t affected if something goes wrong.
What Redis Caches in WordPress
WordPress has a built-in cache, the WP_Object_Cache class, but by default it only lasts for a single request. As soon as PHP finishes building the page, everything in it is thrown away.
Redis keeps those results in memory between requests. When you add a Redis drop-in (a file called object-cache.php that replaces WordPress’s default cache), WordPress stores query results in Redis. On later requests, even from different users, it reads them from memory instead of asking MySQL again.
- Autoloaded options (active plugins, site settings, widget configuration) load straight from memory on every request.
- Post and taxonomy lookups skip expensive SQL joins across tables like
wp_postsandwp_term_relationships. - Admin dashboard response times usually improve noticeably on plugin-heavy sites, because repeated option and metadata lookups skip MySQL.
Step 1: Install Redis and the PHP Extension on Your VPS
There is no Redis switch in hPanel for this, so connect to your VPS over SSH and install the server and the PHP extension:
sudo apt update
sudo apt install -y redis-server php-redis
sudo systemctl enable --now redis-server
redis-cli pingThe last command should answer PONG. Restart PHP-FPM afterwards (for example sudo systemctl restart php8.3-fpm, matching your PHP version) so PHP loads the extension. php -m | grep redis should then print redis.
By default, Redis on Ubuntu and Debian listens only on the local machine (127.0.0.1:6379), which is what the configuration below assumes and keeps Redis unreachable from the internet.
Step 2: Add the Redis Settings and a Key Salt to wp-config.php
Always set a unique key salt before activating an object cache. If staging copies or other sites run on the same server, they share the same Redis instance and overwrite each other’s data unless their keys differ.
Open wp-config.php in your WordPress root folder (over SSH or SFTP), and paste these lines above the /* That's all, stop editing! Happy publishing. */ line:
// Redis Object Cache configuration
define( 'WP_REDIS_SCHEME', 'tcp' );
define( 'WP_REDIS_HOST', '127.0.0.1' );
define( 'WP_REDIS_PORT', 6379 );
define( 'WP_REDIS_TIMEOUT', 1 );
define( 'WP_REDIS_READ_TIMEOUT', 1 );
// Unique salt to prevent key collisions between sites on the same server
define( 'WP_CACHE_KEY_SALT', 'mysite_prod_' );
// Keep cache lifetime reasonable (7 days in seconds)
define( 'WP_REDIS_MAXTTL', 604800 );Use a different salt for each site, such as mysite_staging_ on a staging copy. The 1-second timeouts matter: if Redis ever crashes or restarts, PHP gives up on the connection quickly instead of hanging until the request times out. Reload any page of your site afterwards; if it loads normally, the file syntax is fine.
Step 3: Install and Enable the Redis Object Cache Plugin
Several plugins provide a Redis drop-in. Till Krüss’s Redis Object Cache is widely used and well maintained.
Install and enable it with WP-CLI, from your WordPress root folder:
# Navigate to your WordPress root directory
cd /var/www/html
# Install and activate the plugin
wp plugin install redis-cache --activate
# Enable the Redis drop-in
wp redis enableReplace /var/www/html with your own WordPress folder. wp redis enable copies the plugin’s object-cache.php drop-in into your wp-content/ folder. You should see Success: Object cache enabled. in your terminal.
Prefer the dashboard? Go to Settings > Redis and click Enable Object Cache. The status should change to “Connected”, along with your Redis server version and memory details.
Step 4: Confirm Cache Hits and Check Redis Memory
A green status badge only shows that WordPress can connect. Check that data is actually being stored in Redis.
From your WordPress folder, run:
# Check the status and live metrics
wp redis status
# Fetch a specific cached entry
wp cache get alloptions optionsThe status output should report the cache as connected. The second command prints your site’s stored options if WordPress is reading them from Redis.
You can also watch Redis commands live with redis-cli:
redis-cli monitorOpen your site in a private browser window and load a few pages. You should see a stream of GET and SET commands in your terminal, with key names that start with the salt you set. The lines look like this:
1793108340.102341 [0 127.0.0.1:48292] "GET" "mysite_prod_wp_:options:alloptions"
1793108340.104521 [0 127.0.0.1:48292] "GET" "mysite_prod_wp_:posts:142"
1793108340.105128 [0 127.0.0.1:48292] "GET" "mysite_prod_wp_:post_meta:142"Press Ctrl + C to stop the monitor. Don’t leave it running on a busy site, because it slows Redis down.
Step 5: Exclude Short-Lived Cache Groups (Optional)
Some cache groups hold short-lived data that isn’t worth keeping in Redis. You can tell the drop-in to leave specific groups out by listing them in wp-config.php. This constant replaces the plugin’s default list, so only add it if you have a reason to:
// Keep these groups out of Redis; they live in PHP memory for the current request only
define( 'WP_REDIS_IGNORED_GROUPS', [ 'counts', 'plugins', 'themes', 'wc_session_id' ] );On busy sites, run scheduled tasks from a real server cron instead of relying on visitor traffic. The guide to replace WP-Cron with a real cron job is written for hPanel; on a VPS, the same command goes into your system crontab.
If Redis Shows “Disconnected” or Errors
If the plugin shows “Disconnected” or the site shows fatal errors, check these causes:
1. The Drop-in File Is Missing or Has the Wrong Owner
If WordPress can’t write wp-content/object-cache.php because of file permissions, the drop-in is never installed and the plugin keeps reporting that the object cache is disabled. Check ownership and permissions over SSH (replace www-data with your PHP user):
ls -l wp-content/object-cache.php
sudo chown www-data:www-data wp-content/object-cache.php
sudo chmod 644 wp-content/object-cache.php2. Connection Refused, or Redis Uses a Socket
If connections to 127.0.0.1:6379 are refused, check that the service is running (sudo systemctl status redis-server should show active (running)) and how it is configured to listen:
sudo grep -E "^(bind|port|unixsocket)" /etc/redis/redis.confIf Redis is set up with a unixsocket path instead of a TCP port, point the wp-config.php settings at that socket (and make sure your PHP user is allowed to read it):
define( 'WP_REDIS_SCHEME', 'unix' );
define( 'WP_REDIS_PATH', '/run/redis/redis-server.sock' );3. Stale or Corrupted Cached Data
If wp-admin shows old settings after a major update, flush the cache completely from your WordPress folder:
wp cache flush4. Other Common Problems
- WP-CLI refuses to run as root: it stops with a warning when you’re logged in as root. Run it as the site’s user instead, for example
sudo -u www-data wp redis status. - The plugin says the PhpRedis extension is missing: PHP-FPM wasn’t restarted after Step 1, or the extension was installed for a different PHP version than the site uses.
- Your VPS runs OpenLiteSpeed or LiteSpeed: PHP there is LiteSpeed’s own build (LSPHP), so the
php-redispackage and the PHP-FPM restart don’t apply. Install LiteSpeed’s Redis extension for your LSPHP version and restart the web server instead.
For memory limits and eviction settings, see the official Redis documentation.
Frequently Asked Questions
Does Redis replace LiteSpeed Cache or WP Rocket?
No. Page caching plugins create and serve ready-made HTML pages to logged-out visitors. Redis caches the results of database lookups that WordPress makes while building pages. They solve two different bottlenecks, so most busy sites use both together.
Why is Redis not available on my Hostinger shared or cloud plan?
Because Hostinger doesn’t offer it on those plans, according to its documentation. Web and Cloud hosting plans have an Object Cache option in hPanel instead, which uses LiteSpeed Memcached with the LiteSpeed Cache plugin. To use Redis, you need a VPS where you install and manage it yourself, as in this guide.
How much memory does WordPress need in Redis?
Usually not much. An object cache for a typical site takes tens of megabytes; large WooCommerce stores need more. Check the real figure with redis-cli info memory and set maxmemory in redis.conf accordingly, so Redis can’t use up the VPS’s RAM.
Will Redis break WooCommerce cart updates?
It shouldn’t. WooCommerce keeps carts and sessions in its own database table, with one row per customer session, and an object cache only speeds up those lookups. Carts mixed up between users come from full-page caching of the cart or checkout pages, not from Redis.
Next Steps
With the object cache active, compare response times before and after using your browser’s DevTools or WebPageTest. Look at the time to first byte (TTFB) on dynamic pages such as /wp-admin/ and /checkout/, where the difference shows most. If you’re moving an existing site onto the VPS, follow the guide to migrate a large WordPress site with SSH and WP-CLI, and enable Redis after the import.

