SSL handshake error: stream_socket_enable_crypto(): SSL operation failed with code 1. OpenSSL Error messages:
error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed
php curl 执行 https 请求时报错如上
下载 cacert.pem
wget https://curl.haxx.se/ca/cacert.pem --no-check-certificat
mv cacert.pem /etc/pki/tls/certs/cacert.pem
修改 PHP OpenSSL 证书
php --ini
查看 php.ini
的路径
将原有的证书文件替换为下载的 cacert.pem
[openssl]
; The location of a Certificate Authority (CA) file on the local filesystem
; to use when verifying the identity of SSL/TLS peers. Most users should
; not specify a value for this directive as PHP will attempt to use the
; OS-managed cert stores in its absence. If specified, this value may still
; be overridden on a per-stream basis via the "cafile" SSL stream context
; option.
; openssl.cafile=/etc/pki/tls/certs/ca-bundle.crt
openssl.cafile=/etc/pki/tls/certs/cacert.pem
重新执行即可~
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。