PHP Classes

An advice about permissions

Recommend this page to a friend!

      PHP Classes blog  >  5 Common Laravel Requ...  >  All threads  >  An advice about permissions  >  (Un) Subscribe thread alerts  
Subject:An advice about permissions
Summary:Needed write only to storage and the bootstrap/cache
Messages:3
Author:Daniele Corti
Date:2019-09-19 09:15:38
Update:2020-08-17 14:28:12
 

  1. An advice about permissions   Reply   Report abuse  
Picture of Daniele Corti Daniele Corti - 2019-09-20 03:02:59
Hi,
In the documentation on laravel.com, is suggested to give the write permissions only to storage and the bootstrap/cache directories.

About the command to do this, I think is better:

cd PATH/TO/YOUR/WEBSITE/
sudo chmod -R 555 ./
sudo chmod -R 776 ./storage
sudo chmod -R 776 ./bootstrap/cache

(remember to add the dot before /)

Another thing: if you are on an hosting provider, usually, all the operation are performed by the same user which run the PHP instance, so adding file and installing through composer set the right ownership.

But, if you are using a dedicated webserver for you laravel app, you should check the user and group owner of the files.
Depending on you distribution, you should check if the user and group are correct.

Usually apache run over:
- RedHat based distro: apache:apache
- Debian based distro: www-data:www-data

While ngnix run over:
- RedHat based distro: ngnix:ngnix
- Debian based distro: www-data:www-data (not sure about this)

Hope this helps

  2. Re: An advice about permissions   Reply   Report abuse  
Picture of Decode Web Decode Web - 2019-09-20 23:42:17 - In reply to message 1 from Daniele Corti
Hi. Thanks for replying. I would consider your advice/suggestion in future.

  3. Re: An advice about permissions   Reply   Report abuse  
Picture of janemans janemans - 2020-08-17 14:28:12 - In reply to message 1 from Daniele Corti
Awesome