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

Laravel执行composer u时无法连接repo.packagist.org:443求助

Composer SSL连接错误(repo.packagist.org)排查与解决

问题场景

在Laravel 7环境下执行composer u(即composer update)命令时,触发以下SSL连接错误:

Loading composer repositories with package information
https://repo.packagist.org could not be fully loaded (curl error 35 while downloading https://repo.packagist.org/packages.json: OpenSSL SSL_connect: SSL_ERROR_SYSCALL in connection to repo.packagist.org:443 ), package information was loaded from the local cache and may be out of date

环境版本:

  • Laravel 7
  • PHP 7.2.5
  • Composer 2.4.4

该错误核心是无法与repo.packagist.org建立有效的SSL连接,导致Composer只能使用过期的本地缓存包信息,无法获取最新依赖数据。

解决方法

  • 检查网络连通性:先通过ping repo.packagist.org确认域名可正常解析访问;国内用户可切换至国内Composer镜像,执行命令:composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/
  • 升级OpenSSL版本:PHP 7.2.5搭配的旧版OpenSSL可能无法支持当前TLS协议,将OpenSSL升级至1.1.1及以上版本后,重启PHP服务
  • 配置PHP curl扩展:确保php.ini中extension=curl已启用,同时设置curl.cainfo指向有效的CA证书文件(可更新至最新CA证书)
  • 清除Composer缓存:执行composer clear-cache清除过期缓存,再重新运行composer update
  • 临时SSL跳过验证(仅测试用):执行composer update --insecure临时绕过SSL验证,但此方法存在安全风险,禁止在生产环境使用

内容的提问来源于stack exchange,提问作者Ali Salehi

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.08.06 04:50:33