我创建了一个Laravel应用程序并使用Elastic Beanstalk将其部署到EC2实例。一切似乎除了PHP来工作,所以我得到这个错误不能写入storage
目录:Laravel和AWS Elastic Beanstalk - 文件权限
Error in exception handler: The stream or file "/var/app/current/site/app/storage/logs/laravel.log"
could not be opened: failed to open stream:
No such file or directory in /var/app/current/site/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php:84
这看起来像一个权限问题给我,所以我一直在使用的http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/customize-containers-ec2.html指令设置尝试权限。
我有一个文件01permissions.config
在.ebextensions
目录:
commands:
storage_permissions:
command: chmod -R 755 $EB_CONFIG_APP_ONDECK/site/app/storage
我得到的服务器日志以下错误:
[ERROR] Command storage_permissions (chmod -R 755 $EB_CONFIG_APP_ONDECK/site/app/storage) failed
[DEBUG] Command storage_permissions output: chmod: cannot access ‘/site/app/storage’: No such file or directory
任何想法是怎么回事?
你什么意思,你忽视了日志目录?我有同样的问题,但在项目中没有.gitignore我忽略存储目录。它是否与每个文件夹中的所有.gitignore文件有关? (日志,会话等) – 2015-03-26 18:38:01
我想我在主目录中忽略了.gitignore_global中的日志。看看这个。如果没有,请在日志目录中放置一个空的.gitignore文件,因为Git不会跟踪空目录。 – Josh 2015-03-26 21:14:01
谢谢@Josh。我们正在使用Jenkins来推动我们的构建,事实证明它正在删除.gitignore文件(这些文件夹都在这些文件夹中),然后删除文件夹,因为它们是空的。我为每个文件夹添加了一些虚拟文件,并立即修复了消失的文件夹问题。 – 2015-03-27 12:37:44