7
votes

Migrating symfony apps to php 7 with no success.

Error messages:

Symfony 2.8:

Warning: session_write_close(): Failed to write session data (user). Please verify that the current setting of session.save_path is correct (/var/lib/php/sessions)

Symfony 3.1:

Warning: session_regenerate_id(): Session object destruction failed. ID: user (path: /var/lib/php/sessions)

Problem

Now from the message I would guess php is trying to write sessions to files.

  • I use memcached handler for sessions, it is running and works with php 5.6.
  • If I use native_file handler - everything works.

I do not know how to make any sense from this. All answers I found to similar problems include switching from native_file to memcached (already using it), changing user and/or permissions for session dir (does not matter?), updating session handler to return true from some methods (updated and checked).

How do I debug this?

2
What returns dump(ini_get('session.save_handler')); command ?AlterPHP
Well, some magic happened... Dumped save_handler, it displayed user, changed to native_file and to memcached again - now it works! Not sure what happened, but other app on same server also started to work, nothing was changed, updated or anything. Will do more testing.Aurelijus Rozenas
So I did not get to the bottom of this because in the end we just switched to redis. It works fine for php 5.6 and 7.1 and symfony 2.8-3.2.Aurelijus Rozenas

2 Answers

1
votes

Use
$ sudo service memcached start

-1
votes

Set

php.auto_start=1   

in php.ini