PHP 远程 AWS EB 实例 'php artisan migrate' 上的致命错误:laravel.log:权限被拒绝

PHP Fatal Error on 'php artisan migrate' on remote AWS EB instance: laravel.log: Permission denied

当我通过 SSH 连接到我的 AWS EB 实例到 运行 php artisan migrate 时,我收到以下错误消息:

Link to bigger size of picture below

我完全糊涂了。首先,我在本地服务器上没有收到此错误。其次,一个简单的日志文件与迁移有什么关系?默认情况下,它们会被 git 忽略,因此不会上传任何日志文件。

唉...关于如何允许我 运行 我的 php artisan migrate 有什么想法吗?

它始终是存储文件夹。空白页或权限被拒绝,这是该死的存储文件夹。

我不知道 EB 是如何工作的,如果它是常规发行版或什么,但您应该将存储文件夹的所有权更改为 Web 服务器(最有可能是 www-data),以便它可以构建视图然后设置775 权限,因此您可以 write/read 记录。

所以像这样:

sudo chown -R www-data:www-data storage/
sudo chmod -R 775 storage/

我遇到了同样的错误

如所述

AWS AMI uses webapp as the web user, not apache or ec2-user as the file shows. In that case, the webapp user has no access rights over those files.

因此,按照其中提到的步骤解决了问题

sudo chown $USER:webapp ./storage -R

find ./storage -type d -exec chmod 775 {} \;

find ./storage -type f -exec chmod 664 {} \;

取决于你之后的目标you might need to go through this too