卡在resolving dependencies不是timeout问题,而是dns或连通性故障;需用dig/curl手动测镜像可用性、换dns、检查hosts、试手机热点;卡在downloading才调http.timeout(建议600秒);卡在executing command则设composer_process_timeout=1200。

卡在 Resolving dependencies 就不动?这不是 timeout 的问题
这一步根本没发 HTTP 请求,Composer 只是在查 packagist.org 或镜像域名的 IP 地址。改 http.timeout 完全无效,纯属白等。
常见现象包括:Could not resolve host、unknown host、ping packagist.org 失败。
- 先手动测 DNS:运行
dig mirrors.aliyun.com @114.114.114.114,看是否能返回正确 IP - 临时换系统 DNS:Linux/macOS 改
/etc/resolv.conf加nameserver 8.8.8.8;Windows 在网络适配器里手动设 - 检查
/etc/hosts(或C:\Windows\System32\drivers\etc\hosts)是否误写了错误的packagist.org映射 - 用手机热点试一次——很多企业网会屏蔽
packagist.org和github.com,但热点通常通
报 cURL error 28 或卡在 Downloading https://?调 http.timeout 才管用
这是真正的 HTTP 层超时,http.timeout 控制每次请求从 DNS 查询、TLS 握手、到响应头返回的总时间,默认仅 60 秒,对国内镜像或大包明显不够。
围绕关键发现、作用机制、临床相关性及研究局限性展开讨论。适用于撰写或优化任何生物医学论文的“讨论(Discussion)”部分——包括结果解读、与既往文献关联、阐释意外发现、界定研究局限性,以及撰写结论。当用户输入以下任一指令时也会自动触发该功能: - “write my discussion” - “help me discuss my findings” - “how do I compare to prior studies” - “write the limitations par
- 全局设置(推荐):
composer config -g http.timeout 600 - 项目级更稳妥(CI 友好):在
composer.json的"config"段加"http.timeout": 600 - 临时调试优先用环境变量:
COMPOSER_HTTP_TIMEOUT=600 composer install,避免污染配置 - 注意:
process-timeout在这里完全不生效;PHP CLI 的default_socket_timeout也会干扰,可绕过:php -d default_socket_timeout=600 $(which composer) install
报 The process timed out 或卡在 Executing command?该设 COMPOSER_PROCESS_TIMEOUT
这时候 Composer 已拿到包,正在解压、运行 post-install-cmd、git clone 私有仓库,甚至执行 php artisan optimize。错误里带 [RuntimeException] The process timed out 就是它。
- 新版 Composer 不再读取
composer config -g process-timeout,别信老教程 - 真正有效的只有环境变量:
COMPOSER_PROCESS_TIMEOUT=1200(Linux/macOS)或 Windows 系统变量 - CI 中建议设为
0(不限时),尤其首次安装或缓存失效时 - 若涉及私有 GitLab/GitHub 仓库,确保
git自身配置正常:git config --global http.sslVerify false(仅测试环境)、代理设置匹配
用了代理还连不上?curl -v 是唯一可信线索
curl -v https://mirrors.aliyun.com/composer/packages.json 的输出比 Composer 错误信息更真实。关键看最后一行卡在哪:
- 停在
* Trying 218.108.192.192:443...→ TCP 连接失败,查防火墙、代理地址、DNS - 停在
* TLS handshake→ 证书验证失败或中间人代理未导入根证书,检查系统时间是否同步(尤其 WSL/Docker) - 停在
后无响应 → 镜像源本身异常,换腾讯云或华为镜像试试 - 公司代理下务必确认
HTTP_PROXY/HTTPS_PROXY环境变量已设,且值正确;旧版 Composer 需额外配cafile:composer config -g cafile /path/to/cacert.pem
真正麻烦的不是 timeout 值本身,而是网络路径中某一段(DNS、TLS、中间代理、镜像节点)出现非对称延迟——它可能只影响特定包、特定时刻,所以单纯拉长 http.timeout 是必要但不充分的。










