卡在resolving dependencies是dns或tcp层问题,非timeout能解决;应手动测dns、绑定hosts、确认镜像生效;卡在downloading才调http.timeout;卡在executing command需设process-timeout或composer_process_timeout。

卡在 Resolving dependencies 是 DNS 或 TCP 层问题,不是 timeout 能解决的
看到这行输出就停住,说明 Composer 还没发任何 HTTP 请求,连域名解析都没完成。改 http.timeout 或 process-timeout 完全无效。
常见现象包括:Resolving dependencies 卡住几十秒、curl -v https://mirrors.aliyun.com/composer/packages.json 报 Resolving host 超时、或 dig packagist.org 返回超慢甚至空结果。
- 优先手动测 DNS:运行
dig mirrors.aliyun.com @114.114.114.114,若响应正常但系统默认 DNS 慢,临时改/etc/resolv.conf(Linux/macOS)或网络设置(Windows)为8.8.8.8或223.5.5.5 - 绕过 DNS 缓存:直接在
/etc/hosts或C:\Windows\System32\drivers\etc\hosts绑定镜像 IP,例如123.56.123.45 mirrors.aliyun.com - 确认镜像源已生效:运行
composer config -g repos.packagist.org.url,输出必须是https://mirrors.aliyun.com/composer/,不是packagist.org或已停用的旧地址
卡在 Downloading https://… 该调 http.timeout,不是 process-timeout
这一阶段报 cURL error 28、Could not fetch 或反复重试后静默退出,99% 是单次 HTTP 请求等不及响应。process-timeout 完全不参与这个过程。
http.timeout 最终会映射为 cURL 的 CURLOPT_TIMEOUT,它管整个请求生命周期(DNS + TCP + TLS + HTTP body),不是只管建连的 CURLOPT_CONNECTTIMEOUT。
围绕关键发现、作用机制、临床相关性及研究局限性展开讨论。适用于撰写或优化任何生物医学论文的“讨论(Discussion)”部分——包括结果解读、与既往文献关联、阐释意外发现、界定研究局限性,以及撰写结论。当用户输入以下任一指令时也会自动触发该功能: - “write my discussion” - “help me discuss my findings” - “how do I compare to prior studies” - “write the limitations par
- 项目级覆盖更安全:
composer config http.timeout 600,写入当前composer.json的config段 - 临时调试优先用环境变量:
COMPOSER_HTTP_TIMEOUT=600 composer install,避免污染配置 - PHP CLI 的
default_socket_timeout也会干扰:运行php -i | grep default_socket_timeout,若值为 60,可临时绕过:php -d default_socket_timeout=600 $(which composer) install
卡在 Executing command 或报 The process timed out?该调 process-timeout
这是子进程(如 git clone、unzip、php artisan optimize)执行太久被杀,和网络无关。错误里带 [RuntimeException] The process timed out.,且 -vvv 最后一行明确停在某条命令上。
process-timeout 默认 300 秒,只管子进程执行时长,不影响任何 HTTP 行为。全局配置 composer config --global process-timeout 在新版中已失效。
- 项目级推荐:
composer config process-timeout 1800,写入当前composer.json,安全且可提交 - 真正有效的全局方式是环境变量:
export COMPOSER_PROCESS_TIMEOUT=1800(Linux/macOS),Windows 下设系统变量 - 临时调试用:
composer install --process-timeout=1800或COMPOSER_PROCESS_TIMEOUT=1800 composer update
私有 Git 仓库 clone 超时,Composer 的 timeout 配置完全无效
只要 composer.json 里仓库类型是 "type": "git" 或 URL 是 git@/https://xxx.git,Composer 就会调用系统 git clone,此时 process-timeout 和 http.timeout 全部失效。
Git 层超时必须由 Git 控制,不是 Composer 能干预的:
- HTTPS 协议:
git config --global http.postBuffer 524288000、git config --global http.lowSpeedLimit 0、git config --global http.timeout 300 - SSH 协议:依赖
~/.ssh/config中的ConnectTimeout - 最快绕过方式:让私有仓库提供
dist下载地址,在composer.json中显式声明"dist": {"url": "https://xxx.zip", "type": "zip"}










