stream_socket_client(): SSL operation failed with code 1. OpenSSL Error messages:
error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed
12 Answers
Best Answer
最简单修复方法如下:
wget --no-check-certificate http://curl.haxx.se/ca/cacert.pem -O /usr/local/openssl/ssl/cert.pem
已经修复
是更新到最新版本就行了吗? 我最后google了一天才解决 原因是php没有加载ca证书 ,这个ca证书加载后之前我说的那个file_get_contents抓取不到https的问题也解决了.
我用whmcs发邮件,打开debug模式,也是这个报错,环境是nginx+mysql5.5+php5.6+ionCube 是7月6日安装的环境,报错信息是:2017-07-07 01:41:49 Connection: opening to ssl://hwsmtp.exmail.qq.com:465, timeout=300, options=array ( ) 2017-07-07 01:41:49 Connection: Failed to connect to server. Error number 2. "Error notice: stream_socket_client(): SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed 2017-07-07 01:41:49 Connection: Failed to connect to server. Error number 2. "Error notice: stream_socket_client(): Failed to enable crypto 2017-07-07 01:41:49 Connection: Failed to connect to server. Error number 2. "Error notice: stream_socket_client(): unable to connect to ssl://hwsmtp.exmail.qq.com:465 (Unknown error) 2017-07-07 01:41:49 SMTP ERROR: Failed to connect to server: (0) 2017-07-07 01:41:49 SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting
cd /usr/local/php/etc
wget http://curl.haxx.se/ca/cacert.pem
vi php.ini
#openssl.cafile='' //大约在2018行删除# 并替换下面这个 前提是下载路径和我的一样
openssl.cafile=/usr/local/php/etc/cacert.pem
Please login or Register to submit your answer