Shopware 5长脚本5分钟超时求助:如何延长上游超时时间?
解决Shopware 5长脚本上游超时问题
环境与现有配置
基于PHP 7.3 + PHP-FPM运行Shopware 5,服务器环境为WHM,已配置以下参数:
PHP-FPM配置
request_terminate_timeout = 300s
NGINX配置
# Timeout settings for Nginx client_body_timeout 1800s; # Time in seconds (30 minutes) client_header_timeout 1800s; # Time in seconds (30 minutes) keepalive_timeout 3600s; # Keep-alive timeout (optional, 1 hour) send_timeout 1800s; # Time to wait for a response (30 minutes) # If using proxy proxy_read_timeout 1800s; # Allow for longer responses (30 minutes) proxy_send_timeout 1800s; # Allow for longer sends (30 minutes) fastcgi_read_timeout 1800s; fastcgi_send_timeout 1800s;
PHP配置
max_execution_time 1800s memory_limit -1
确认未被.htaccess文件覆盖配置。
问题描述
运行时长超过5分钟的脚本会被终止,报错信息如下:
[error] 105907#105907: 14762 upstream timed out (110: Connection timed out) while reading response header from upstream, client: .., server: my-domain.com, request: "GET /api/subPath HTTP/1.1", upstream: "https://..*:444/api/subPath", host: "my-domain.com"
解决方案
从报错和现有配置来看,核心问题是PHP-FPM的request_terminate_timeout仅设置为300s(5分钟),会强制终止运行超5分钟的PHP进程,即便NGINX和PHP的其他超时参数已调到1800s。
按以下步骤修改:
- 找到对应PHP7.3版本的PHP-FPM配置文件(WHM中可通过
MultiPHP Manager操作,或直接编辑服务器文件,比如/etc/php/7.3/fpm/pool.d/www.conf) - 修改
request_terminate_timeout参数,设置为与其他超时参数匹配的1800s:request_terminate_timeout = 1800s - 重启PHP-FPM服务(WHM中通过
Service Manager操作,或执行命令systemctl restart php-fpm7.3) - 额外检查:
- 确认WHM的
Apache/NGINX配置中无额外超时限制 - 检查Shopware 5后台的脚本超时设置部分电商系统自带执行时间限制
- 确认WHM的
注:报错显示上游为HTTPS代理,你已配置proxy_read_timeout和proxy_send_timeout为1800s,这部分无需调整,核心修复点为PHP-FPM的终止超时参数。
内容的提问来源于stack exchange,提问作者Darpan Chaudhari
相关产品推荐
相关产品推荐

