Symfony 3.1.5 Warning: SessionHandler::read(): Session data file is not created by your uid

Editing config/config.yml and replacing save_path: "%kernel.root_dir%/../var/sessions/%kernel.environment%" with save_path: /var/lib/php/sessions fixed the error.

If you use an editor/IDE that automatically converts spaces to tabs, be sure to disable that feature before saving your changes. Failure to do so may cause a 'does not contain valid YAML' error to occur.


I had the same problem. The fix that worked for me is to change var/sessions owner to www-data:www-data (same user/group for php-fpm sub-processes) :

sudo chown -R www-data:www-data var/sessions/

AVOID change prod configuration for troubles that only occurs in development environment

Had the Same trouble when using Vagrant (PHP-FPM 7 + Nginx) with a sync folder (/vagrant ~ default)

Solved just put

    session:
        save_path: '/tmp'

on config_dev.yml inside framework entry

Just choose some place that Webserver and PHP can read/write without permission issues.