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

Shopware 6商店激活在Admin UI引发通用错误及排查需求

Shopware 6商店激活问题排查与解决方案

问题背景

在Shopware 6.4.17.2实例的后台UI激活商店时,遇到以下异常:

  1. 初始仅显示通用错误提示:「激活出错,请重试,若仍失败请联系管理员」,浏览器控制台报错:
/api/_action/extension/activate/plugin/SwagExtensionStore
Failed to load resource: the server responded with a status of 500 (Internal Server Error)

/api/notification/message?limit=5:1 
Failed to load resource: net::ERR_NAME_NOT_RESOLVED

/api/_info/queue.json
Failed to load resource: net::ERR_NAME_NOT_RESOLVED

/bundles/administration/static/js/commons.js?1668607807231938
Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'data')
    at commons.js?1668607807231938:1:203362
  1. 重试后触发内存耗尽提示:
Internal Server Error
Error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 6242480 bytes)

核心问题解答

1. 是否需要提升PHP内存限制?

是的,128MB的内存限制(134217728字节)远不足以支撑Shopware插件激活这类需要加载大量依赖、处理资源的操作。Shopware官方推荐PHP内存限制至少设置为256MB,复杂场景建议提升至512MB。

2. 是否优先使用CLI执行激活操作?

强烈建议优先通过CLI命令完成激活,优势如下:

  • 可临时指定内存限制,无需修改全局php.ini,命令示例:
    php -d memory_limit=512M bin/console plugin:activate SwagExtensionStore
    
  • 避开Web服务器的额外内存、超时限制,稳定性更高,尤其适合资源消耗大的操作。

3. 如何配置获取有效错误日志?

API的500错误未写入var/log/production*.log,通常由以下原因导致,对应解决方法:

  • Web服务器与CLI的PHP配置不一致:检查Web服务器对应的php.ini(如Apache的php.ini或Nginx的fastcgi_param配置),确保开启错误日志记录:
    error_reporting = E_ALL
    log_errors = On
    error_log = /path/to/shopware/var/log/php_errors.log
    
  • Shopware日志规则未覆盖API错误:修改config/packages/prod/monolog.yaml,添加API专属日志规则:
    monolog:
        handlers:
            main:
                type: stream
                path: "%kernel.logs_dir%/%kernel.environment%.log"
                level: error
                channels: ["!event"]
            api:
                type: stream
                path: "%kernel.logs_dir%/api_%kernel.environment%.log"
                level: error
                channels: ["api"]
    
  • 目录权限不足:确保var/log目录对Web服务器进程(如www-data、nginx)有写入权限,执行命令修复:
    chown -R www-data:www-data htdocs/shopware/var/log
    chmod -R 755 htdocs/shopware/var/log
    

另外,浏览器控制台中的ERR_NAME_NOT_RESOLVED错误,说明服务器无法解析API相关域名,需检查服务器DNS配置,确保能正常访问内部API地址。


内容的提问来源于stack exchange,提问作者Ingo Steinke

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.08.11 10:00:24