php中,使用memcache作為session的save handler 一般會使用如下設置:
php.ini里:
session.save_handler = memcache
session.save_path = “localhost:11211″
項目配置里:
ini_set(“session.save_handler”, “memcache”);
ini_set(“session.save_path”, “127.0.0.1:11211″);
在網上很多資料會寫成這樣:
session.save_path = “tcp://localhost:11211″
就是連接前綴里添加了tcp:// 這是會導致php的memcache模塊寫入失敗,切記一定不要添加tcp協議前綴!
session.save_path
string
Defines a comma separated of hostname:port entries to use for session server pool, for example “sess1:11211, sess2:11211″.
If you want to use ‘memcacheD’ extention not ‘memcache’ (there are two diffrent extentions) for session control, you should pay attention to modify php.ini
Most web resource from google is based on memcache because It’s earlier version than memcacheD. They will say as following
session.save_handler = memcache
session.save_path = “tcp://localhost:11211″
But it’s not valid when it comes to memcacheD
you should modify php.ini like that
session.save_handler = memcached
session.save_path = “localhost:11211″
Look, there is no protocol indentifier
Most web resource from google is based on memcache because It’s earlier version than memcacheD. They will say as following
session.save_handler = memcache
session.save_path = “tcp://localhost:11211″
But it’s not valid when it comes to memcacheD
you should modify php.ini like that
session.save_handler = memcached
session.save_path = “localhost:11211″
Look, there is no protocol indentifier