Problème d'installation de Composer sur Debian Wheezy

Classé dans : Web, Linux | Aucun commentaire

jeudi 17 novembre 2016

En essyant d'installer composer, le gestionnaire de dépendance de php sur une Debian Wheezy avec PHP 5.5, j'ai eu le message d'erreur suivant : 

root@myserver:/var/www# curl -sS https://getcomposer.org/installer | php
All settings correct for using Composer
PHP Warning:  file_get_contents(): Unable to set verify locations `/etc/ssl/certs/ca-certificates.crt' `(null)' in - on line 770

Warning: file_get_contents(): Unable to set verify locations `/etc/ssl/certs/ca-certificates.crt' `(null)' in - on line 770
PHP Warning:  file_get_contents(): failed to create an SSL handle in - on line 770

Warning: file_get_contents(): failed to create an SSL handle in - on line 770
PHP Warning:  file_get_contents(): Failed to enable crypto in - on line 770

Warning: file_get_contents(): Failed to enable crypto in - on line 770
PHP Warning:  file_get_contents(https://getcomposer.org/versions): failed to open stream: operation failed in - on line 770

Warning: file_get_contents(https://getcomposer.org/versions): failed to open stream: operation failed in - on line 770
PHP Warning:  Invalid argument supplied for foreach() in - on line 516

Warning: Invalid argument supplied for foreach() in - on line 516
None of the 0 stable version(s) of Composer matches your PHP version (5.5.38-1~dotdeb+7.1 / ID: 50538)

La solution à ce problème se trouve dans ce post : https://github.com/composer/composer/issues/2798 : 

L'idée est de remplacer le certificat par un qui fonctionne : 

wget http://curl.haxx.se/ca/cacert.pem
cp /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt.old
mv cacert.pem /etc/ssl/certs/ca-certificates.crt

Ensuite, on peut lancer l'install de composer :

curl -sS https://getcomposer.org/installer | php -- --cafile=cacert.pem