1. Installation of epel,memcached,php,httpd,php memcache extension
Yum Install-y epel*
Yum install-y httpd php memcached php*memcache
2. Start Httpd,memcache
Service httpd Start
Memcached-d-M 20-u root-p 12000
3, vim/var/www/html/04.php
<?php
Phpinfo ();
?>
Browser opens http://192.168.20.95/04.php
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/5D/F1/wKiom1UnmwHBIFlrAAJMYK5tzjE524.jpg "title=" Qq20150410174210.png "alt=" Wkiom1unmwhbiflraajmyk5tzje524.jpg "/>
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/5D/F1/wKiom1Unmx7T2o2mAACrotjS-aU638.jpg "title=" Qq20150410174220.png "alt=" Wkiom1unmx7t2o2maacrotjs-au638.jpg "/>
The above information indicates that PHP's memcache extension is correct.
4, vim/var/www/html/05.php
<?php
Ini_set (' Session.gc_maxlifetime ', 3600);
Ini_set ("Session.save_handler", "memcache");
Ini_set ("Session.save_path", "tcp://127.0.0.1:12000");
Session_Start ();
$_session[' name '] = "Liu de hua";
echo $_session[' name ']. " <br/> ";
Echo session_id (). ' <br/> ';
?>
Browser opens http://192.168.20.95/05.php
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/5D/EC/wKioL1UnnUDD2v0FAADCiK0B73w371.jpg "title=" Qq20150410174634.png "alt=" Wkiol1unnudd2v0faadcik0b73w371.jpg "/>
5. Enter Memcache view
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/5D/F1/wKiom1UnnA-xUE6EAADU_Ok6i7w678.jpg "title=" Qq20150410174702.png "alt=" Wkiom1unna-xue6eaadu_ok6i7w678.jpg "/>
has been successful.
This article is from the "Lao Cai" blog, please be sure to keep this source http://877763363.blog.51cto.com/1200927/1631023
Storing session with Memcache