1. Install Httpd,epel,redis, PHP's Redis extension
Yum install-y epel* (install Epel extension Yum source first)
Yum install-y httpd Redis Php*redis (after installing the Epel, and then installing Redis, the Redis extension with PHP)
2. Start Httpd,redis
Service httpd Restart
Service Redis Restart
3, vim/var/www/html/01.php
<?php
Phpinfo ();
?>
4. Browser Open http://192.168.20.95/01.php
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/5D/F1/wKiom1UnkzWSCT-eAAFaF7ujHD4536.jpg "title=" Qq20150410170901.png "alt=" Wkiom1unkzwsct-eaafaf7ujhd4536.jpg "/>
Indicates that a PHP extension is installed
5, vim/var/www/html/02.php
<?php
Ini_set (' Session.gc_maxlifetime ', 3600);
Ini_set ("Session.save_handler", "Redis");
Ini_set ("Session.save_path", "tcp://127.0.0.1:6379");
Session_Start ();
$_session[' name '] = "Liu de hua";
echo $_session[' name ']. " <br/> ";
Echo session_id (). ' <br/> ';
?>
Browser opens http://192.168.20.95/02.php
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/5D/F1/wKiom1UnlOGwF_W_AACvxJljw3g133.jpg "title=" Qq20150410171622.png "alt=" Wkiom1unlogwf_w_aacvxjljw3g133.jpg "/>
6. We enter Redis to view information
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/5D/EC/wKioL1UnlmWimQeFAAGO6Rvosx0826.jpg "title=" Qq20150410171718.png "alt=" Wkiol1unlmwimqefaago6rvosx0826.jpg "/>
We found this information in Redis and said it was successful.
7, we can also modify the following parameters in/etc/php.ini
Session.gc_maxlifetime
Session.save_handler
Session.save_path
This article is from the "Lao Cai" blog, please be sure to keep this source http://877763363.blog.51cto.com/1200927/1631009
Using Redis storage session