我试图在我的项目中运行composer install但是我有以下错误
[Composer\Downloader\TransportException]
The "http://packagist.org/p/provider-2013$43e3f41fbe30a46245103451248f688a727f076a6e90636d19a69a156c17a416.json" file could not be downloaded (HTTP/1.1 400 Received invalid request from Client)
我试图运行composer自我更新并出现此错误
[Composer\Downloader\TransportException]
The "https://getcomposer.org/version" file could not be downloaded: Failed to enable crypto failed to open stream: operation failed
我在代理服务器后面使用apache / php5.6.4 / mysql运行Ubuntu 15.04。
我尝试下载http://curl.haxx.se/ca/cacert.pem并使用以下
更新了我的php.ini文件curl.cainfo=/etc/ssl/certs/cacert.pem
openssl.cafile=/etc/ssl/certs/cacert.pem
openssl.capath=/etc/ssl/certs
运行composer diagnose会返回此
Checking composer.json: OK
Checking platform settings: OK
Checking git settings: OK
Checking http connectivity to packagist: FAIL
[Composer\Downloader\TransportException] The "http://packagist.org/packages.json" file could not be downloaded (HTTP/1.1 400 Received invalid request from Client)
Checking https connectivity to packagist: OK
Checking HTTP proxy: OK
Checking HTTP proxy support for request_fulluri: FAIL
Unable to assess the situation, maybe packagist.org is down (The "http://packagist.org/packages.json" file could not be downloaded (HTTP/1.1 400 Received invalid request from Client))
Checking HTTPS proxy support for request_fulluri: OK
Checking github.com rate limit: OK
Checking disk free space: OK
Checking composer version: FAIL
You are not running the latest version
最后openssl_get_cert_locations()返回
我完全失去了什么是错误的,甚至更多的是如何调试它。
我希望那里有人可以帮助我!
答案 0 :(得分:5)
PATH\xampp\apache
并运行makecert.bat
2 - 将此脚本添加到composer.json文件
"repositories": [
{
"type": "composer",
"url": "https://packagist.org"
},
{
"packagist": false
}
]
答案 1 :(得分:1)
如果您是Linux(Ubuntu)用户,请执行以下命令来解决:
php -r "print_r(openssl_get_cert_locations());"
wget http://curl.haxx.se/ca/cacert.pem
sudo mv cacert.pem /usr/lib/ssl/certs/cert.pem // Note: Create the cert.pem file under certs folder if does not exist.
答案 2 :(得分:0)
答案 3 :(得分:0)
在环境中设置代理,在终端中使用:
export http_proxy=<proxy>:<port>
export https_proxy=<proxy>:<port>
答案 4 :(得分:0)
如果linux - service iptables停止
或关闭Windows上的防病毒防火墙
答案 5 :(得分:0)
该问题很可能与某种HTTPS实施有关,因为从以上composer diagnose
来看,HTTP连接测试失败,而HTTPS测试通过了:
Checking HTTP connectivity to packagist: FAIL
...
Checking HTTP proxy support for request_fulluri: FAIL
...
Checking HTTPS proxy support for request_fulluri: OK
运行以下代码段(强制在作曲家使用HTTPS)为我解决了问题:
composer config -g repo.packagist composer https://packagist.org
答案 6 :(得分:0)
如果以上都不适合您,请尝试删除系统设置“环境变量”的 http_proxy 环境变量