file_put_contents(/var/www/html/w3code/storage/framework/sessions/CXwN3EXKxERD6jgy3rADcaAAbAx8FRKih2JK7UO9): Failed to open stream: Permission denied

Created at 07-Feb-2023 , By samar

The error "file_put_contents() failed to open stream: Permission denied for Session folder" in Laravel usually occurs when the server does not have sufficient permissions to write to the sessions folder. To resolve this issue, make sure the web server has write permissions for the storage/framework/sessions directory.

Here is a step by step guide to solve the above error.

Open window terminal using CTRL + ALT + T shortcut keys.

Now you have to run the below command to give the necessary permission to storage/session folder.

sudo chmod 755 -R /var/www/html/laravel-project/storage

Note: You have to change the text laravel-project with your laravel project name in above command.

If you like what you are reading, please consider buying us a coffee ( or 2 ) as a token of appreciation.

Buy Me A Coffee

Don't forget to share this article! Help us spread the word by clicking the share button below.

We appreciate your support and are committed to providing you valuable and informative content.

We are thankful for your never ending support.