5

I have been using memcached and I upgraded from PHP 5.4 to 5.6 and now it is failing to connect and store.

I have:

ini_set('session.save_handler', 'memcached');
ini_set('session.save_path', 'serverAddress:11211');
session_start();

I have also tried tcp:// before the server address, but no luck there.

In the error log, I am getting the following errors:

  • PHP Warning: session_start(): Write of lock failed
  • PHP Warning: session_start(): Unable to clear session lock record
  • PHP Warning: Unknown: Failed to write session data (memcached). Please verify that the current setting of session.save_path is correct

I guess something changed in the versions of PHP. Any help is appreciated, thanks!

Note: I am using Amazon Elastic Beanstalk for the web server and ElastiCache for the memcached

What I Have Tried

  1. Used a config file with:

    files:
      "/etc/php.d/setup.ini":
        mode: "000644"
        owner: root
        group: root
        source: https://s3.amazonaws.com/path/to/file.ini
    

Inside of the ini file is:

    [php]

    session.save_handler = memcached
    session.save_path = 'memcached.server.path.cache.amazonaws.com:11211'
  1. I have tried using session_write_close()
  2. I have tried using tcp:// before the server path
  3. I have also tried using memcache instead of memcached as the handler.
austinh
  • 1,061
  • 6
  • 13
  • 34
  • I just tried using a .ebextensions .config file to change the master value instead of using ini_set in the page, but that does not seem to work either and throws the same errors. – austinh Jan 29 '16 at 16:29
  • I have the same problem. It happens very rarely, but it happens. It seems to be a bug in PHP: https://github.com/php-memcached-dev/php-memcached/issues/269 – The Onin Mar 17 '17 at 10:38
  • Did you ever find a fix for this issue? – Jacco Jun 13 '17 at 09:37

0 Answers0