我已经使用 Amazing Beanstalk 部署了我的 Laravel 5.1 应用程序,经过反复使用,我最终得到了这个错误。
"file_put_contents(/var/app/current/storage/framework/cache/d4/d7/d4d77eddeb64100f6da8f8b601a4631b): failed to open stream: Permission denied"
在我的 .ebextensions 配置文件中,我尝试将此命令添加到部署中,但它无法解决问题,因为这些文件似乎是在部署后随着浏览站点而创建的。
container_commands:
"02-chmod-storage":
command: "cd /var/app/ondeck; chmod -R 777 storage"
如何永久解决此问题?
最佳答案
这应该可以做到:
commands:
create_post_dir:
command: "mkdir /opt/elasticbeanstalk/hooks/appdeploy/post"
ignoreErrors: true
files:
"/opt/elasticbeanstalk/hooks/appdeploy/post/99_chmod_storage.sh":
mode: "000755"
owner: root
group: root
content: |
#!/usr/bin/env bash
. /opt/elasticbeanstalk/support/envvars
cd $EB_CONFIG_APP_CURRENT
su -c "chmod -R 777 storage" $EB_CONFIG_APP_USER
关于PHP Beanstalk 的 laravel 权限在存储/框架/缓存上被拒绝,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33707298/