Afterlogic Webmail - Nginx 到 Apache "Cannot declare class, name is already in use"

Afterlogic Webmail - Nginx to Apache "Cannot declare class, name is already in use"

我从官方网站下载了Afterlogic Webmail,它在apache上运行良好。

将其移动到使用 apache 的官方 docker 它工作正常 (https://github.com/afterlogic/docker-webmail-pro)

将它移到我的 docker 设置中,我将其用于所有其他使用 nginx 的项目似乎会导致 php 类 加载两次。

Fatal error: Cannot declare class Aurora\Modules\ActivityHistory\Module, because the name is already in use in /var/www/modules/ActivityHistory\/Module.php on line 245

这是直接从 https://afterlogic.com/download/webmail-pro-php.zip 拉取的默认项目。

nginx 配置

server {
    listen 80;
    index index.php index.html;
    root /var/www;
    access_log /var/log/nginx/access.log;
    error_log /var/log/nginx/error.log;
    location / {
        try_files $uri /index.php?$query_string;
    }

    location ~ \.php$ {

        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass ${LARANAME}:9000;
        fastcgi_index /index.php;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_param PATH_INFO $fastcgi_path_info;
    }
}

docker-compose.yml

version: '3.7'
services:
  app:
    container_name: wbmail_app_dev
    build:
      context: .
      dockerfile: docker/app.dev.dockerfile
    ports:
      - '4721:80'
    volumes:
      - './:/var/www/'
    networks:
      - wbmail-network-dev
    ports: []
  web:
    container_name: wbmail_web_dev
    build:
      context: .
      dockerfile: docker/web.dev.dockerfile
    ports:
      - '4721:80'
    volumes:
      - './:/var/www/'
    environment:
      - LARANAME=wbmail_app_dev
    networks:
      - wbmail-network-dev
  db:
    container_name: wbmail_db_dev
    image: 'mariadb:latest'
    environment:
      MYSQL_DATABASE: wbmail_test
      MYSQL_ROOT_PASSWORD: cr0ssf1r3
    networks:
      - wbmail-network-dev
networks:
  wbmail-network-dev:
    driver: bridge

php信息(): https://codepasta.app/paste/c1e7nmvout2tbkhn2dk0

事实证明,代码中存在错误,导致多次尝试包含同一文件。该问题已得到纠正,从下一版本开始,该修复程序将包含在产品中。

对于遇到问题并需要在安装时更正它的用户,请在 system/autoload.php 文件中找到以下行:

$sModuleName = substr($sModuleClassName, 0, -7);

并将其替换为:

$sModuleName = substr($sModuleClassName, 0, strpos($sModuleClassName, '\'));

感谢 Andrew Gosselin 研究此问题并提供修复。