0

I am getting Unexpected error,

Exception: Warning: SessionHandler::read(): open(/var/opt/remi/php72/lib/php/session/sess_5292j25aa4ugpdgrv9r6a3l3p8, O_RDWR) failed: Permission denied (13) in /usr/share/nginx/html/gta/vendor/magento/framework/Session/SaveHandler/Native.php on line 22 in /usr/share/nginx/html/gta/vendor/magento/framework/App/ErrorHandler.php:61

How to solve the error?

4 Answers 4

1

For me I have solved this problem by deleting the session that is causing the problem (it is indicated in the message Exception: Warning). Identify this problematic php session in the php session directory, with this command: sudo ls -la var/lib/php/sessions/ For me it's: sess_6uha84kjcvjmq6qjsh0ctee5ff, then simply delete it, being careful to run the rm command with sudo: sudo rm -rf var/lib/php/sessions/sess_6uha84kjcvjmq6qjsh0ctee5ff my site reloaded without problem. I hope this will help you. Made in magento 2.4.2

2
  • Worked for a Magento 2.3.2 as well, Thanks!
    – rukrlf
    Commented Jul 21, 2021 at 6:59
  • sudo chmod -R 777 /var/lib/php/session/
    – Vipin Garg
    Commented Nov 20, 2023 at 10:29
0

Doesn't seems to be Magento related, but PHP related.

The error says Permission denied, so the user executing the PHP code can't write on the PHP session path.

As you mention nginx, I assume you're using php-fpm. Check your pool to see the user and group and verify if it matches the rights on the path /var/opt/remi/php72/lib/php/session

Sometimes it also happens when nginx is using the nginx user and not www-data user.

1
0

I usually have this issue when circling from one version to another for the same instance. I noticed that deleting that session from /var/lib/sessions/ solves it.

0

Open www.config file of php-fpm and locate the configs session.save_handler, session.save_path, and make the below changes:

php_value[session.save_handler] = files

;php_value[session.save_path] = /var/lib/php/session

if this does not work, then make the same changes in the php.ini file of your system. For Centos, it is located at /etc/php.ini.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.