# yum --enablerepo=epel install php-pecl-redis Installed: php-pecl-redis.x86_64 0:2.2.8-1.el6 Dependency Installed: php-cli.x86_64 0:5.3.3-48.el6_8 php-common.x86_64 0:5.3.3-48.el6_8 php-pear.noarch 1:1.9.4-5.el6 php-pecl-igbinary.x86_64 0:1.2.1-1.el6 Complete!
# redis-cli ping PONG
# vi /etc/php.ini ;session.save_handler = files session.save_handler = redis ;session.save_path = "/var/lib/php/session" session.save_path = "tcp://localhost:6379"
# service httpd restart
# vi redis_session_test.php <?php session_start(); echo "save_handler=" . ini_get("session.save_handler") . "\n"; echo "save_path=" . ini_get("session.save_path") . "\n"; echo "session_id=" . session_id() . "\n"; $_SESSION['libname'] = "PhpRedis";
# php redis_session_test.php save_handler=redis save_path=tcp://localhost:6379 session_id=2eu2qe11sqod2t6grbqba3c1g0
# redis-cli 127.0.0.1:6379> keys * 1) "PHPREDIS_SESSION:2eu2qe11sqod2t6grbqba3c1g0"