bencarter78@hotmail.com's avatar

Unable to run composer install

I'm trying to run composer install 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 have tried to run composer self-update 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'm running Ubuntu 15.04 with apache/php5.6.4/mysql behind a proxy.

I have tried downloading http://curl.haxx.se/ca/cacert.pem and updated my 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 diagnose 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'm at a total loss as to what's wrong and even more how I can debug this.

I hope there's someone out there can help me!

0 likes
6 replies
bashy's avatar

Have you done a cURL test to see if you can connect to the domain?

curl -IL http://packagist.org/packages.json

You could also try downloading the latest version over the top of your current one manually.

No issues with latest composer for me

composer diagnose
Checking composer.json: OK
Checking platform settings: OK
Checking git settings: OK
Checking http connectivity to packagist: OK
Checking https connectivity to packagist: OK
Checking github.com rate limit: OK
Checking disk free space: OK
Checking composer version: OK
bencarter78@hotmail.com's avatar

@bashy tried that and everything seems good.

HTTP/1.1 200 OK
Server: nginx
Date: Fri, 31 Jul 2015 14:50:20 GMT
Content-Type: application/json
Content-Length: 1072
Last-Modified: Fri, 31 Jul 2015 14:50:14 GMT
ETag: "55bb8b26-430"
Accept-Ranges: bytes
Proxy-Connection: keep-alive
bashy's avatar

So appears to be something related to how it connects from composer binary. Tried using the latest version manually?

bencarter78@hotmail.com's avatar

Well I've got a partial answer here, by adding the following environment variable I am able to run composer install.

HTTP_PROXY_REQUEST_FULLURI=true

However, I'm still getting an error when I try to composer self-update

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

@ohffs yeh I set that too thanks.

I'm assuming the 'Failed to enable crypto' is something about not using the correct certificates?

Please or to participate in this conversation.