卡在Downloading https://xxx.zip时应调http.timeout,因其控制DNS解析、TLS握手、首字节等待及body传输总时长,默认300秒易触发;项目级执行composer config http.timeout 600,全局用composer config -g http.timeout 600,临时调试设COMPOSER_HTTP_TIMEOUT=1200,并确保PHP default_socket_timeout同步调高。

卡在Downloading https://xxx.zip时该调http.timeout
这是 HTTP 下载阶段卡住,比如拉取 laravel/framework 的 dist 包,错误里常带 cURL error 28 或反复 retry 后失败。它不看 process-timeout,只认 http.timeout(Composer 2.x)。
http.timeout 控制 DNS 解析 + TLS 握手 + 首字节等待 + 整个 body 传输的总时间,单位秒,默认仅 300(5 分钟),弱网或大包场景极易触发。
- 项目级最稳:运行
composer config http.timeout 600,写入当前composer.json的config段,可提交、可复现 - 全局生效:用
composer config -g http.timeout 600,写入~/.composer/config.json - 临时覆盖优先级最高:
COMPOSER_HTTP_TIMEOUT=1200 composer install,适合 CI 调试
注意:php -i | grep default_socket_timeout 查出的 PHP CLI default_socket_timeout 若低于你设的 http.timeout,会提前掐断连接——常见值是 60,务必同步调高。
process-timeout 才管 git clone 和 post-install-cmd
如果你装的是 "type": "git" 的开发版依赖(如 "monolog/monolog": "dev-main"),Composer 会调系统 git clone,而这个过程受 process-timeout 约束,不是 http.timeout。
错误里一定含 [RuntimeException] The process "" exceeded the timeout,加 -vvv 可看到最后那条命令(比如 git clone https://github.com/...)。
专业音乐创作规划。基于 mmx-cli(MiniMax AI)生成高质量音乐和歌曲,自动规划曲风、节奏、乐器编配和人声特色,将模糊需求转化为精准 Prompt。支持纯器乐和中文歌词歌曲。
- 全局改:运行
composer config -g process-timeout 1800(30 分钟) - 项目级改:直接在
composer.json顶层加"config": {"process-timeout": 1200} - CI 环境建议用环境变量兜底:
COMPOSER_PROCESS_TIMEOUT=2000,某些 Composer 版本对它更敏感
设为 0 表示不限时,但不推荐——万一远程 Git 仓库彻底不可达,会无限挂起。
换源不能绕过 git 类依赖的超时
阿里云镜像(https://mirrors.aliyun.com/composer/)只加速 dist 包下载,对 git 类源(github.com、gitlab.com)完全无效。这类依赖仍会直连原始地址,卡住就是它的问题。
- 强制走 HTTPS(避开 SSH 认证失败):
composer config -g github-protocols https - 给系统
git加超时(Linux/macOS):git config --global core.sshCommand "timeout 300 ssh" - 确保
http.proxy和https.proxy已配置(若需代理):composer config -g http.proxy http://127.0.0.1:8080
别把私有 GitLab/GitHub 仓库也加进 repositories 配置里——镜像不代理 VCS,反而会导致 Failed to clone https://xxx: could not connect to server。
验证是否真卡在网络,还是卡在 autoload 或脚本
运行 composer install -vvv,盯住最后一行输出:
- 停在
Resolving dependencies→ DNS 或源不可达,跟 timeout 无关 - 停在
Downloading https://...→ 调http.timeout - 停在
Executing command (CWD: ...)→ 调process-timeout - 停在
Generating autoload files后无响应 → 不是网络问题,是文件系统(如 WSL2 symlink)、PHP 配置(max_execution_time、memory_limit)或 APCu 未启用 CLI 模式
真正卡住的地方,往往不在你调的那个参数上;-vvv 输出的最后一行,才是你该动手改的地方。

















