How to Set Up Redis Object Caching for WordPress in CWP with ALT PHP 8.3

0 7 hours ago

Enabling Redis object caching on your WordPress site can significantly boost performance by reducing database queries and speeding up backend response times. This guide walks you through setting up Redis caching using Control Web Panel (CWP) and ALT PHP-FPM 8.3, with Redis installed locally on your server.

Whether you run a single high-traffic website or host multiple WordPress sites, Redis is more scalable and powerful than APCu β€” and ideal for WooCommerce or dynamic content caching.


βœ… What You’ll Achieve

  • Redis server installed and running
  • PHP 8.3 configured with Redis extension
  • WordPress integrated with Redis cache
  • Verified object cache running efficiently

πŸ”§ Step 1: Install Redis Server on Your CWP Server

SSH into your server and run:

yum install redis -y
systemctl enable redis
systemctl start redis

Check status:

systemctl status redis

βœ… You should see: active (running)


βœ… Step 2: Compile and Install Redis Extension for PHP-FPM 8.3

Since ALT PHP builds don’t include PECL by default, you’ll compile it manually:

Download and build:

cd /usr/local/src
wget https://pecl.php.net/get/redis
tar -xzf redis
cd redis-*
/opt/alt/php-fpm83/usr/bin/phpize
./configure --with-php-config=/opt/alt/php-fpm83/usr/bin/php-config
make
make install

βœ… Output should confirm:

Installing shared extensions: /opt/alt/php-fpm83/usr/lib/php/extensions/...

βœ… Step 3: Enable Redis Extension in PHP 8.3

Edit your PHP config:

nano /opt/alt/php-fpm83/usr/php/php.ini

Add this line:

extension=redis.so

Then restart PHP-FPM:

systemctl restart php-fpm83

πŸ§ͺ Step 4: Verify Redis Extension is Active

Run:

/opt/alt/php-fpm83/usr/bin/php -m | grep redis

βœ… You should see: redis


πŸ”Œ Step 5: Enable Redis Caching in WordPress

Install Plugin:

  1. Go to WordPress Dashboard β†’ Plugins β†’ Add New
  2. Search for: Redis Object Cache
  3. Install and activate it
  4. Go to Settings β†’ Redis
  5. Click Enable Object Cache

The plugin should auto-connect to your local Redis server.


Optional: Add Redis Configuration in wp-config.php

If Redis doesn’t connect automatically:

define('WP_REDIS_HOST', '127.0.0.1');
define('WP_REDIS_PORT', 6379);
define('WP_REDIS_DISABLED', false);

βœ… Step 6: Confirm It’s Working

  • Go to Tools β†’ Site Health
  • βœ… The β€œUse persistent object cache” warning should be gone
  • Plugin dashboard shows: Status: Connected and Object Cache: Enabled

πŸš€ Why Redis Over APCu?

FeatureRedisAPCu
Shared across sitesβœ…βŒ (per-process)
Network accessibleβœ…βŒ
Scalable (WooCommerce)βœ…βŒ
Persistentβœ…βŒ (RAM-only)

Redis is ideal for multiple WordPress sites, high-traffic projects, and stores using WooCommerce or LMS plugins.


🧠 Pro Tip: Pre-Configure Redis for All WordPress Installs

To automate Redis use:

  • Pre-install the Redis Object Cache plugin
  • Add this to your wp-config.php template:
define('WP_REDIS_HOST', '127.0.0.1');
define('WP_REDIS_PORT', 6379);
define('WP_REDIS_DISABLED', false);

Now all future WordPress installs will auto-connect to Redis.


πŸ’¬ Need Expert Setup?

Prefer a hands-free setup?

πŸ“¨ Contact Servers9 Support β€” they’ll install Redis, configure PHP, and set up WordPress caching professionally for you.