AWS Elastic Beanstalk部署HumHub出现scandir目录不存在错误如何解决
AWS Elastic Beanstalk部署HumHub扫描模块目录错误修复方案
触发的错误如下:
PHP Warning – yii\base\ErrorException
scandir(/var/app/current/protected/modules): Failed to open directory: No such file or directory
修复步骤
- 第一步先校验目录是否存在
远程SSH登录到你的Elastic Beanstalk运行实例,执行命令ls /var/app/current/protected/检查输出是否存在modules目录。
大概率是你打包上传部署包时,本地的.gitignore规则过滤了该目录,或者打包时遗漏了该目录,确认本地HumHub源码的protected/modules目录完整存在后,重新打包部署即可。 - 第二步如果目录存在则修复权限
Elastic Beanstalk环境中PHP默认以webapp用户身份运行,目录权限不足也会触发读不到目录的报错,执行以下命令手动修复权限:
如需每次部署自动配置权限,在项目根目录新建sudo chown -R webapp:webapp /var/app/current/protected/modules sudo chmod -R 755 /var/app/current/protected/modules.ebextensions/00-permissions.config文件,写入以下配置后重新部署:files: "/opt/elasticbeanstalk/hooks/appdeploy/post/99_set_permissions.sh": mode: "000755" owner: root group: root content: | #!/usr/bin/env bash chown -R webapp:webapp /var/app/current/protected chmod -R 755 /var/app/current/protected - 第三步检查自定义模块路径配置
如果你之前修改过HumHub的模块加载路径配置,打开/var/app/current/protected/config/common.php,检查moduleAutoloaderPaths参数是否和实际的模块存放路径一致,修正错误配置即可。
内容的提问来源于stack exchange,提问作者Ahmed
相关产品推荐
相关产品推荐

