PHP’s default session handler is filesystem-based: each session is a file in /var/lib/php/session or /home/<user>/tmp. On a single-server cPanel host that works fine. On a load-balanced pair of cPanel servers, or on any setup where sessions need to survive across multiple PHP-FPM pools, the filesystem handler does not scale. Pointing PHP at Redis is a one-line change per account once Redis is installed.
What’s happening
session.save_handler = redis plus session.save_path = "tcp://127.0.0.1:6379" tells PHP to send session writes to a Redis instance instead of the local filesystem. Sessions become a key-value pair: the session ID is the key, the serialized session data is the value. Redis handles TTL via session.gc_maxlifetime. The phpredis extension is required for PHP to speak the Redis protocol; cPanel ships it as ea-php<ver>-php-redis.
How to verify
Confirm the prerequisites:
rpm -qa | grep ea-php82-php-redis
systemctl status redis
ss -tlnp | grep :6379
php -r 'echo extension_loaded("redis") ? "yes" : "no";'
grep -E "^session\." /opt/cpanel/ea-php82/root/etc/php.ini
If redis is not in the loaded extensions list, the phpredis RPM is not installed (or installed but not enabled for the version).
The fix
- Install Redis if not present:
yum install -y redis && systemctl enable --now redis. Confirm it is listening on 127.0.0.1:6379 only — never expose Redis on a public interface without auth. - Install the PHP extension:
yum install -y ea-php82-php-redis. Verify it loaded:php -m | grep redis. - Per account, configure the session handler via MultiPHP INI Editor > Basic Mode > add:
The query parameters:session.save_handler = redis session.save_path = "tcp://127.0.0.1:6379?weight=1&timeout=2.5" session.gc_maxlifetime = 1440weightmatters only with multiple servers;timeoutis how long PHP waits for Redis on each call. - Reload the FPM pool:
systemctl reload ea-php82-php-fpm. - Validate. From the account’s docroot, place a one-line probe:
Hit it once, then check Redis:<?php session_start(); $_SESSION['t'] = time(); echo ini_get('session.save_handler');redis-cli KEYS 'PHPREDIS_SESSION:*'. There should be one entry per session. - Plan for the Redis-unavailable case. If Redis is down, every request to that account fails with a 500 from
session_start(). Either run Redis with persistence and a systemd restart policy, or accept that Redis is now a first-class dependency for those accounts.
For environments where session sharing across hosts is required, Stack Harbor sets up Redis-backed sessions during onboarding under environment management.