0

I had an excess of php sessions files created on a server in /var/lib/php5/ so I deleted them, but now php5-fpm and my server refuse to write sessions files.

I assumed that the session files would be able to be recreated, but now the application does not retain session data at all, apparently. What do I do to start the session directory anew?

4
  • Exactly what did you delete? What are the errors that are logged? Oct 29, 2015 at 21:05
  • Is there anything in error logs? Did you delete just content of dir or whole dir? Did you tried to restart php5-fpm service? Oct 29, 2015 at 21:15
  • 1
    If you deleted the directory, chances are your webserver doesn't have permissions to create it again.
    – ceejayoz
    Oct 29, 2015 at 21:20
  • @ceejayoz Yep, turned out that I hadn't just deleted the session files, I had stupidly deleted the whole directory, and of course it was thus unable to recreate sessions, and even when I recreated the directory, it had to be world writable. Whoops.
    – Kzqai
    Oct 29, 2015 at 21:23

1 Answer 1

0

Found the problem, it was a permissions issue with the directory:

php -i | grep session.save_path
session.save_path => /var/lib/php5/sessions => /var/lib/php5/sessions

And that directory had to have the correct write permissions:

sudo ls ../ -halt
total 52K
drwx-wx-wt  2 root root  36K Oct 29 17:21 sessions

I had accidentally made it not world-writable (and maybe not sticky) when I recreated it.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .