failed to open stream: operation failed
錯誤詳細信息:
[Composer\Downloader\TransportException] The "https://packagist.laravel-china.org/packages.json" file could not be downloaded: Peer certificate CN=`*.phphub.org' did not match expected CN=`packagist.laravel-china.org' Failed to enable crypto failed to open stream: operation failed
[Composer\Downloader\TransportException] Content-Length mismatch, received 3444 bytes out of the expected 299952
錯誤發生情境:
使用 composer require 命令下載軟件時。
解決辦法:
(1)更換composer鏡像源,可以執行嘗試以下幾種:
更換成阿里鏡像:composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/
更換成Laravel China鏡像: composer config -g repo.packagist composer https://packagist.laravel-china.org
更換成中國全量鏡像:composer config -g repo.packagist composer https://packagist.phpcomposer.com
(2)如果更換鏡像,還不能下載成功,可能是網絡有問題:
1、(虛擬機環境)可以嘗試把靜態ip更換為動態獲取,橋接改為網絡地址轉換。
2、通過ftp或文件共享方式下載然后上傳。