1

I am running my website on using ec2 nginx. I have done a update on the instance and now I getting this error when the site loads.

open(/var/lib/php/session/sessionid, O_RDWR) failed: Permission denied (13) in /var/www/html/includes/session.php on line 17

 session_start(): Failed to read session data: files (path: /var/lib/php/session) in /var/www/html/includes/session.php on line 17

I am wondering how to fix this?

Appreciate any help Thanks

  • 1
    `/var/lib/php/sessions` is probably owned by `root:root` - try setting the [session save path](https://www.php.net/manual/en/function.session-save-path.php) to a directory that's writable by the PHP user. – CD001 May 13 '22 at 11:46
  • That's the way to go... see also https://stackoverflow.com/questions/6821532/php-warning-permission-denied-13-on-session-start – Honk der Hase May 13 '22 at 16:42

1 Answers1

2

You install PHP from zero in this machine? You already tried to put a complete permission in this folder? Ex: sudo chmod 777 -R /var/lib/php/session

  • This fixed it thank you. Everything was working fine then I installed composer. After that it broke so not sure why. – echobravocharlie May 13 '22 at 12:20
  • Setting `777` is actually a rather bad idea, you don't want to open any part of the system more than what's minimally required. Consider this SO thread: https://stackoverflow.com/questions/27039635/warning-session-start-failed-permission-denied-13 which will eventually lead to https://stackoverflow.com/questions/6821532/php-warning-permission-denied-13-on-session-start – Honk der Hase May 13 '22 at 16:41