Composer install failed

本秂侑毒 提交于 2019-12-01 12:45:05

I solved the issue by downloading https://curl.haxx.se/ca/cacert.pem and giving it's path in my etc/php/5.6/cli/php.ini and etc/php/5.6/apache2/php.ini.

Then after running sudo service apache2 restart && sudo apt install composer just worked fine.

Open terminal and run php -r "var_dump(openssl_get_cert_locations());"

Note the location of default_cert_file. It might say \usr\local\ssl\cert.pem Verify that that file exists. If not, download the cacert.pem file from https://curl.haxx.se/ca/cacert.pem and place it in somewhere preferably in /usr/local/ssl

You now have a file is usr/local/ssl/cacert.pem

Open your php.ini and add the location of the file openssl.cafile=cacert.pem

Install composer

Run composer config --global cafile "/usr/local/ssl/cacert.pem"

It looks like a misconfiguration of PHP/openssl on your host.

My workstation is Ubuntu 16.04.3, php 7.0.22 and openssl-1.0.2g - the installer worked fine.

Try with TLS disabled:

curl -sS https://getcomposer.org/installer | php -- --disable-tls

It is caused by my kaspersky internet security I fixed it by disabling KIS temporary

you can give it a try.

I experienced this problem while using Laravel Homestead after I’d accidentally emptied the contents of this file: /etc/ssl/certs/ca-certificates.crt

What fixed it for me was:

sudo apt-get purge ca-certificates 
sudo apt-get install ca-certificates

Thanks to https://stackoverflow.com/a/53351370/470749

Change the Export proxy from https to http

Open Terminal

    echo $https_proxy
// Change export proxy from 
    https_proxy=https://192.168.0.10:8080/
// to 
   https_proxy=http://192.168.0.10:8080/

cmd:: https_proxy=http://192.168.0.10:8080/

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!