I'm a bit confused here in Symfony functionality terms. I have a website which is supposed to write sessions in /var/lib/php/sessions/
. I'm confused right there, because in /var/www/html/myproject/ everything is recursively property of www-data:www-data
(yes, I'm using Apache). However the owner of /var/lib/php/sessions/
is root
, so when Apache tries to write there, I get a 500 server error regarding writing permissions in that directory.
I have divided opinions here. Some people advice me to modify config.yml
to manage sessions inside the project directory, while other people say that is a really bad practice. But, how do I get everything targeting /var/lib/php/sessions/
without that file permission error?
Here's what I get via Apache URL:
Oops! An Error Occurred
The server returned a "500 Internal Server Error".
Something is broken. Please let us know what you were doing when this error occurred. We will fix it as soon as possible. Sorry for any inconvenience caused.
Here's what I get via php development webserver:
Warning: SessionHandler::read(): open(/var/lib/php/sessions/sess_u3eg1842nlpkbm0rvddrq37dc2, O_RDWR) failed: Permission denied (13)
500 Internal Server Error - ContextErrorException
I really hope you can help me.
/var/www/sessions/
, for example. – Rob W/var/lib/php/sessions/
? – Alain Alemany