PHP报错ssl3_get_server_certificate:certificate verify failed

Uiaoin 2022-05-09 27

PHP安装composer时出现如下报错:

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

......
copy(): SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed
......

 

解决办法:

没有证书,下载并配置证书

1、下载证书 https://curl.haxx.se/ca/cacert.pem ,如保存路径为:/etc/openssl/cacert.pem

2、更改php.ini 中 openssl.cafile=/etc/openssl/cacert.pem

3、重新执行即可

加载更多