Environment: windowsxamppphp5.41. add php_memcache.dll2 to the php installation directory phpext. Modify php. ini and add extensionphp_memcache.dll to php. ini and set [Memcache] memcache. Memory.
Environment: windowsxamppphp5.4 1. add php_memcache.dll 2 to the php installation Directory php \ ext. modify php. ini in php. extension = php_memcache.dll is added to ini and [Memcache] memcache is set. allow_failover = 1 memcache. max_failover_attempts = 20 memcache. chunk_size = 8192 m
Environment: windows + xampp + php5.4
1. Add php_memcache.dll to the php installation Directory php \ ext.
2. Modify php. ini
Add extension = php_memcache.dll in php. ini.
And set
[Memcache]
Memcache. allow_failover = 1
Memcache. max_failover_attempts = 20
Memcache. chunk_size = 8192
Memcache. default_port = 11211
Modify session. save_handler = files to session. save_handler = memcache
3. Restart apache
4. In the D: \ memcacheddirectory, copy the file memcached.exe;
When enabling sessions under memcache, you must enable memcache.
5. Enable memcache
(1) cmd mode: Access C: \ Windows \ system32right to cmd.exe, run as Administrator
Enter the D: \ memcacheddirectory in cmd, and enter (1)memcached.exe-d install;(2)memcached.exe-d start
(2) manually enable the memcache Service
6. Use memcache In the CI framework:
Add code to index. php In the root directory file
Ini_set ("session. save_handler", "memcache ");
Ini_set ("session. save_path", '2017. 0.0.1: 661 ');
Session_set_cookie_params (3600*24*30, '/', '. domain. xom ');
Session_start ();
Initialize memcache and enable the session. In this way, you do not need to initialize or enable the session repeatedly in other CI control files;
Session_set_cookie_params (3600*24*30, '/', '. domain. xom'); used to set the session's work domain and solve the session cross-domain problem,
Domain is a level-1 domain name.
5. test:
connect('127.0.0.1',11211) or die('shit'); $memcache->set('key','hello memcache!'); $out = $memcache->get('key'); echo $out; }}?>
If "hello memcache!" Is output successfully !", It indicates that memcache has been configured successfully.
Link: http://codeigniter.org.cn/user_guide/libraries/sessions.html
Http://www.yaolei.info/archives/194