本文介绍了具有laravel权限的PHP Beanstalk在存储/框架/缓存上被拒绝的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用Amazing Beanstalk部署了Laravel 5.1应用程序,重复使用后最终出现此错误.

I've deployed my Laravel 5.1 app using Amazing Beanstalk and after repeated usage I eventually get this error.

"file_put_contents(/var/app/current/storage/framework/cache/d4/d7/d4d77eddeb64100f6da8f8b601a4631b): failed to open stream: Permission denied"

在我的.ebextensions配置文件中,我尝试将此命令添加到部署中,但由于在浏览站点时似乎在部署后创建了文件,因此无法解决问题.

In my .ebextensions config file I've tried adding this command to deployment but it does not solve the problem since the files seem to get created after deployment as the site is browsed.

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

这篇关于具有laravel权限的PHP Beanstalk在存储/框架/缓存上被拒绝的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-23 18:15