I am having problem with storing session data on a remote memcache server. This is the error i am getting:
[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
On the same server if i try with telnet it works:
[root@centos ~]# 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"
Same thing happens when i use memcached in php.ini:
session.save_handler=memcached
session.save_path="192.168.247.111:11211"
just a bit more info in the 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
the php file is just 3 lines:
<?
session_start();
$_SESSION['somekey'] = "someval";
print_r($_SESSION);
After days of testing and googling i have found that SElinux was the problem. After disabling it everything started working.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.