Home  >  Article  >  Backend Development  >  怎么设置memcached来共享php的session

怎么设置memcached来共享php的session

WBOY
WBOYOriginal
2016-06-13 12:28:31743browse

如何设置memcached来共享php的session

??

如何设置memcached来共享php的session

php的session存储方式可以自定义的,默认是使用文件,也可以用数据库,具体可以查看:http://pt.php.net/manual/en/function.session-set-save-handler.php


如果有多台memcached服务器,那么可以使用php-memcache或者php-memcached做相应的设置

编辑vi /etc/php5/apache2/php.ini

使用php-memcache:

session.save_handler = memcache
session.save_path = "tcp://10.1.1.1:11211"

使用php-memcached:

session.save_handler = memcached
session.save_path = "10.1.1.1:11211"

具体可以参考:

http://php.net/manual/en/memcached.sessions.php 和

https://www.digitalocean.com/community/tutorials/how-to-share-php-sessions-on-multiple-memcached-servers-on-ubuntu-14-04

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:PHP内核(1)内存管理Next article:PHP 学习笔记 (1)