cd
to your /storage/framework/cache/data
or /storage/framework/sessions
or any of the directories in the framework
folder and type ls -la
, you may see something like:
drwxr-sr-x 3 apache apache 16 Oct 16 13:00 bd
drwxr-sr-x 3 apache apache 16 Oct 16 17:38 be
drwxr-sr-x 3 root apache 16 Oct 17 05:00 bf
drwxr-sr-x 3 apache apache 16 Oct 16 13:07 c6
drwxr-sr-x 3 root apache 16 Oct 16 16:15 d3
drwxr-sr-x 3 apache apache 16 Oct 17 12:32 dd
drwxr-sr-x 3 apache apache 16 Oct 17 12:32 e2
drwxr-sr-x 3 root apache 16 Oct 16 16:00 e9
drwxr-sr-x 3 apache apache 16 Oct 16 21:25 f6
drwxr-sr-x 3 apache apache 16 Oct 16 16:56 f8
drwxr-sr-x 4 apache apache 26 Oct 17 06:00 fa
As you can see some directories are owned by root
, to fix this cd
into the storage
directory and run:
(first check which user:group
you need, for AWS it could be ec2-user:apache
):
sudo chmod 2775 . && sudo chown -R apache:apache . && sudo chmod -R og-r . && sudo find . -type d -exec chmod g=rwxs "{}" \; && sudo find . -type f -exec chmod g=rw "{}" \; && sudo setfacl -d -m g::rwx . && sudo setfacl -d -m o::rx .
You may want to include this in your deployment script every time you push changes from your repo.