Persistent Permission Denied Error - laravel

I have seen a few posts on this (and tried the recommended solutions) but they are regarding Laravel 4 - And I am on Laravel 5.
For example;
'Failed to open stream: Permission denied' error - Laravel
I get the Command "dump-autoload" is not defined error and the reason for that is explained here;
http://laravel.io/forum/12-08-2014-command-dump-autoload-is-not-defined
In the above post, composer dump-autoload was suggested. I tried it, and again this morning the same error is back;
ErrorException in Filesystem.php line
74:file_put_contents(/vagrant/source/laravel- excel/storage/
framework/sessions/8338f386fc3de7bdc8d1b6dc7ee6790f71516d98): failed
to open stream: Permission denied`
Any suggestions?

Also, try the above comments and do a
composer self update

You Have to set the permission to Read & Write
In Mac We do this by using
**sudo chmod -R o+w storage**
Storage is the name of file U want to change permission
And currently my terminal is in the same folder where my storage folder is present therefore I did not specify its address

Related

Incorrect file permission when using Laravel Sail with Docker on Windows 11 WSL

When I launch a container from within VS Code, Laravel Sail changes the file permissions to allow me to edit them.
But the command does not work and returns the error:
chown: changing property of 'html/': operation not allowed
Because of this, I cannot edit or create new files, because the owner of the file is root:root.
How can I resolve this?

Laravel - The stream or file failed to open stream: Permission denied

I know this is a common problem on Laravel, but I think I'm having a different issue or else the settings aren't being updated.
I've looked at this Laravel The stream or file "/storage/logs/laravel.log" could not be opened: failed to open stream: Permission denied and this How to set up File Permissions for Laravel 5 (and others) but I still have this issue:
The stream or file "/var/www/html/laravelwebapp/storage/logs/laravel.log" could not be opened: failed to open stream: Permission denied
When I do this after going into the logs directory: $ ls -l laravel.log
I get this:
-rwxrwxr-x 1 apache apache 0 Feb 8 2018 laravel.log
I'm on CentOS which is why the group/user is apache not www-data. Yet even though the log is created by apache and apache is the owner and group, it can't open the stream? Does this mean Laravel is executing as another user? I'm a bit confused here, sorry :/
I've cleared the cache using artisan and also ran composer dump-autload but I can't seem to progress in my application because the log doesn't get written to.
Update: My php application is running as nobody when I run
echo exec('whoami');
Is this the problem and how do I fix that?

Laravel New Project - Permission Denied

I am trying to setup a new Laravel site and I am running into an issue I have never had such problems with before. When loading up my site, I get the error:
The stream or file "/var/www/html/storage/logs/laravel.log" could not be opened: failed to open stream: Permission denied
I have edited the file permissions to 775. I don't know what else to do!
Try changing the owner of the folder:
chown -R apache:apache /var/www/html/
you should change your project folder permission
The stream or file "/var/www/html/storage/logs/laravel.log" could not be opened: failed to open stream: Permission denied
This error basically happens when in your project absent ../storage/logs folder. Firstly you must be check this folder exists in your project. If does not exist this folder add it and inside it .gitignore file.
/storage/logs/.gitignore
*
!.gitignore

Laravel 5.3 Cannot Find File Error

I've setup a project more than a month ago and all of a sudden (this afternoon) I started getting the following error:
ErrorException in Filesystem.php line 111: file_put_contents(/var/www/html/project/api/storage/framework/cache/d8/00/d800874b5dc22b961e0ee92f8d1c5a09c24ee911): failed to open stream: No such file or directory
I've done research and tried the following with no success:
php artisan cache:clear
chmod -R 777 storage (I know this is not ideal)
composer update
Nothing is working. Before the chmod I was getting a permission error. I'm tapped out of ideas. Does anyone know what is causing this and how to resolve it?
You gave 777 to /storage folder but did you also make sure it's in same group as apache server is running?
Generally apache is in www-data group, add storage and bootstrap folder to be written by this group:
chgrp -R www-data /storage /bootstrap
Assign current user and group permission to read and write:
chmod -R ug+rw /storage /bootstrap
I'm 99% sure this will do it.
My server runs CentOS 7 and somehow Selinux was set to enforcing which breaks Laravel for some reason. I remember changing it when I first set up Laravel, but somehow it reverted back.
So setting it to permissive or disabled fixed it for me.
https://www.centos.org/docs/5/html/5.2/Deployment_Guide/sec-sel-enable-disable.html

laravel ErrorException can not create controller

[ErrorException]
file_put_contents(C:\xampp\htdocs\laravel\app/Http/Controllers/MyblogsController.php):
failed to open stream: No such file or directory.
when it ask for create controller this error is shown.i have composer installed and updated
Try running composer install on your project directory.
Also make sure you give write permission to the app/storage directory.
From documentation
Laravel may require one set of permissions to be configured: folders within app/storage require write access by the web server.

Resources