2016-12-14 105 views
0

我在將會話數據存儲在遠程memcache服務器上時遇到問題。這是我收到的錯誤:將會話數據存儲在memcache服務器上

[Wed Dec 14 07:33:18 2016] [error] [client 192.168.247.235] PHP Warning: Unknown: Failed to write session data (memcache). Please verify that the current setting of session.save_path is correct (tcp://192.168.247.111:11211) in Unknown on line 0 

在同一臺服務器,如果我通過telnet嘗試它的工作原理:

[[email protected] ~]# telnet 192.168.247.111 11211 
Trying 192.168.247.111... 
Connected to 192.168.247.111. 
Escape character is '^]'. 
set test 0 100 3 
xxx 
STORED 
get test 
VALUE test 0 3 
xxx 
END 

的php.ini:

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

同樣的事情發生時,我在php.ini中使用memcached:

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

just ab它會在error_log

[Wed Dec 14 07:46:02 2016] [error] [client 192.168.247.235] PHP Warning: session_start(): Write of lock failed in /var/www/html/sess.php on line 2 
[Wed Dec 14 07:46:02 2016] [error] [client 192.168.247.235] PHP Warning: session_start(): Unable to clear session lock record in /var/www/html/sess.php on line 2 
[Wed Dec 14 07:46:02 2016] [error] [client 192.168.247.235] PHP Warning: Unknown: Failed to write session data (memcached). Please verify that the current setting of session.save_path is correct (192.168.247.111:11211) in Unknown on line 0 

php文件的詳細信息僅有3行:

<? 
session_start(); 
$_SESSION['somekey'] = "someval"; 
print_r($_SESSION); 

回答

0

經過測試的天,谷歌上搜索我發現對SELinux是問題。禁用之後,所有事情都開始奏效。

相關問題