-
-
Notifications
You must be signed in to change notification settings - Fork 976
Write access to /tmp folder in php container for applications needing sessions #618
Description
In one of my projects I was encountering some performance problems and I needed to install Blackfire.
After adding the PHP Probe, my API endpoint stopped to work and while researching the cause I found out that Blackfire was requesting write access to the container's /tmp folder for the sessions.
You have 2 ways of resolving the issue, the first involves changing Symfony's config to write sessions to /var/logs/sessions following Symfony's documentation like the following:
session:
handler_id: session.handler.native_file
save_path: '%kernel.project_dir%/var/sessions/%kernel.environment%'
The second one is modifying the Dockerfile for the php container by adding RUN chmod 777 -R /tmp && chmod o+t -R /tmp before the end of the file. I put it right before the line where it copies the docker-entrypoint script.
Not sure if it's too specific to add to the distribution's default file but it might be fine because I don't think it interferes with anything else. I think the second solution is the best one because it does not modify the default Symfony config.
I would be happy to do a PR but I never made one so a bit of help would be great.