echobravocharlie
echobravocharlie

Reputation: 55

open(/var/lib/php/session/...sesionid, O_RDWR) failed: Permission denied (13)

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

Upvotes: 1

Views: 13279

Answers (3)

diarmuidcire
diarmuidcire

Reputation: 61

Updated a phpmyadmin docker container, and received the following error after launch:

Error during session start; please check your PHP and/or webserver log file and configure your PHP installation properly. Also ensure that cookies are enabled in your browser.
    
    session_start(): open(SESSION_FILE, O_RDWR) failed: Permission denied (13)
    
    session_start(): Failed to read session data: files (path: /sessions)

Its a permissions problem on the /sessions directory.

The solve was: chmod 757 sessions

Could be a vulnerability. Comments welcome

Upvotes: 0

electroid
electroid

Reputation: 660

You need to set correct ownership for the /var/lib/php/session folder. In case your webserver is running from nginx user that might be chown -R nginx:nginx /var/lib/php/session or if you are using apache that's chown -R www-data:www-data /var/lib/php/session where nginx and www-data is the user and user group from which webserver is running.

Upvotes: 0

espositovitor
espositovitor

Reputation: 50

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

Upvotes: 1

Related Questions