Failed to start composer installation

I am trying to start composer installation in my project, but I have the following error

[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) 

I tried to run composer self-updating and have this error

 [Composer\Downloader\TransportException] The "https://getcomposer.org/version" file could not be downloaded: Failed to enable crypto failed to open stream: operation failed 

I am running Ubuntu 15.04 with apache / php5.6.4 / mysql behind a proxy.

I tried to download http://curl.haxx.se/ca/cacert.pem and updated the php.ini file with the following

 curl.cainfo=/etc/ssl/certs/cacert.pem openssl.cafile=/etc/ssl/certs/cacert.pem openssl.capath=/etc/ssl/certs 

Running composer diagnostics returns this

 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 

And finally, openssl_get_cert_locations () returns

  • default_cert_file: /usr/lib/ssl/cert.pem
  • default_cert_file_env: SSL_CERT_FILE
  • default_cert_dir: / usr / lib / ssl / certs
  • default_cert_dir_env: SSL_CERT_DIR
  • default_private_dir: / usr / lib / ssl / private
  • default_default_cert_area: / usr / lib / ssl
  • ini_cafile: /etc/ssl/certs/cacert.pem
  • ini_capath: / etc / ssl / certs

I have a complete loss as to what is wrong and even more how I can debug it.

I hope there someone can help me!

+9
source share
7 answers

same thing with you. and I found a way to enable it (for window 10) on the Internet. 1 - go to the PATH\xampp\apache folder and run makecert.bat 2 - add this script to the composer.json file

 "repositories": [ { "type": "composer", "url": "https://packagist.org" }, { "packagist": false } ] 
+4
source

If you are a Linux (Ubuntu) user, run the following commands to solve:

 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. 
+1
source

Perhaps you can try changing your proxy.

http://composer-proxy.jp/

Here is the proxy from Japan. Hope this works for you.

0
source

Try php composer global self-update

0
source

Set the proxy in the environment, use this in the terminal:

 export http_proxy=<proxy>:<port> export https_proxy=<proxy>:<port> 
0
source

if linux - service iptables stop

or close antivirus, firewall in Windows

0
source

Most likely, the problem is related to any forced use of HTTPS, given that from the above composer diagnose specified by composer diagnose , HTTP connection tests failed during the HTTPS test:

 Checking HTTP connectivity to packagist: FAIL ... Checking HTTP proxy support for request_fulluri: FAIL ... Checking HTTPS proxy support for request_fulluri: OK 

Running the below snippet (to force HTTPS to install on the composer) solved this problem for me:

 composer config -g repo.packagist composer https://packagist.org 

Solution Source

0
source

All Articles