Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Failed to write session data, php and memcached

Tags:

php

memcached

I have recently tried implementing memcached for session saving in php. I modified the session.save_handler in my php.ini and for the most part it works correctly. Sessions are saved in it. However, once in a while, I get this weird message for certain sessions:

PHP Warning: Unknown: Failed to write session data (memcached). Please verify that the current setting of session.save_path is correct (x.x.x.x:11211) in Unknown on line 0.

The session data is the same, way under the 1MB barrier of memcached and I have yet to see a pattern in the occurences of this message... maybe a couple of times every minute. The website is usually under medium load, 150 users concurrently.

like image 510
Marc Avatar asked Aug 24 '12 15:08

Marc


1 Answers

If you are using memcache then save_path must have the tcp:// prefix.

If you are using memcached then the save_path should not have the tcp:// prefix.

like image 192
craig.tadlock Avatar answered Sep 22 '22 14:09

craig.tadlock