mercredi 24 juin 2020

Permission problems with Laravel's storage directory on CentOS 7. Changing permissions and ownship with chmod and chown does not solve it

I figured this out myself while I was revising my question, but I'm going to post my original question anyway with the solution in case it helps anyone else.

The solution has nothing to do with symbolic links or Deployer, but I'm going to leave my question as is in case someone came to the same problem in a similar way.


I'm trying to set up a Laravel 5.8 deployment using Deployer on a CentOS 7 server.

The deployment is successful. The storage folder is set as a shared directory in my deploy.php file, so what it does it sets up the storage folder as a persistent shared folder between releases. It does this by creating a symbolic link to a shared storage folder for the releases.

There is a folder for the current release at /var/www/test-laravel/current, which is actually a symbolic link to the folder with the most recent release (in this case /var/www/test-laravel/releases/18). Inside that folder the storage folder is actually a symbolic link to /var/www/test-laravel/shared/storage.

I was getting the following error,

The stream or file "/var/www/test-laravel/releases/18/storage/logs/laravel-2020-06-25.log" could not be opened: failed to open stream: Permission denied

After trying a few variations of permissions/owners/groups, out of frustration I manually ran chmod -R 777 and chown -R apache.apache on not just the original storage folder but on all of the symlink folders as well.

This hasn't changed anything at all. I'm still getting the same error.

I don't think this should make a difference, but just for good measure I've run php artisan cache:clear, php artisan view:clear and php artisan config:clear.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire