You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

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

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.09.25 22:45:05