Tag Archives: PHP Warning: copy(): SSL operation failed with code 1. OpenSSL Error messages:

[Solved] Composer Install Error: PHP Warning: copy(): SSL operation failed with code 1. OpenSSL Error messages:

Problem description

#php -r "copy('https://install.phpcomposer.com/installer', 'composer-setup.php');"

PHP Warning:  copy(): SSL operation failed with code 1. OpenSSL Error messages:
error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed in Command line code on line 1
PHP Warning:  copy(): Failed to enable crypto in Command line code on line 1
PHP Warning:  copy(https://install.phpcomposer.com/installer): failed to open stream: operation failed in Command line code on line 1

Solution:

Download certificate http://curl.haxx.se/ca/cacert.pem 
wget http://curl.haxx.se/ca/cacert.pem
Or use the web page to download and upload to linux
mkdir -p /usr/local/openssl/ssl/certs/
mv cacert.pem /usr/local/openssl/ssl/certs/cacert.pem

Modify php.ini

;openssl.capath=
openssl.cafile=/usr/local/openssl/ssl/certs/cacert.pem

Problem-solving

Reinstall the composer