Laravel和Xampp权限问题

时间:2020-01-07 12:51:25

标签: linux laravel permissions xampp

我刚接触Linux(Mint),已经安装了xampp并克隆了我的Git存储库。

问题是我没有访问文件的权限,所以我运行了chmod 755,但是任何新文件都存在相同的问题。

错误消息:

无法打开流:权限被拒绝

我想知道我是否错误地安装了xampp,或者在运行sudophp artisan migrate之类的命令时是否使用composer update导致用户无法访问这些文件?

这是怎么回事?

1 个答案:

答案 0 :(得分:1)

第1步:整理根目录:

sudo chown -R www-data:www-data /path/to/root

第2步:授予FTP上传和使用文件的权限(使用任何FTP客户端):

sudo usermod -a -G www-data ubuntu

第3步:将文件权限设置为644:

sudo find /path/to/root -type f -exec chmod 644 {} \;

第4步:将目录权限设置为755:

sudo find /path/to/root -type d -exec chmod 755 {} \;

第5步:授予Web服务器读写存储和缓存的权限

sudo chgrp -R www-data storage bootstrap/cache
sudo chmod -R ug+rwx storage bootstrap/cache

参考:https://vijayasankarn.wordpress.com/2017/02/04/securely-setting-file-permissions-for-laravel-framework/

相关问题