我们刚刚升级到从PHP 5.4 PHP的5.6和一切工作正常使用我们的MySQL使用的MySQLi和SSL连接。
我们连接的样子:
mysqli_real_connect($db, $host, $username, $password, $database, $port, $socket, MYSQLI_CLIENT_SSL);
mysqli_set_charset($db, "utf8");
Howerver,现在当我们尝试使用PHP 5.6,我们正在连接到MySQL通过SSL:
警告:mysqli_real_connect():SSL操作失败,代码1的OpenSSL错误消息:错误:14090086:SSL例程:SSL3_GET_SERVER_CERTIFICATE:证书验证失败在/MySQLConnection.php上线29
警告:mysqli_real_connect():无法通过在线29 /MySQLConnection.php使用SSL连接到MySQL
警告:mysqli_real_connect():[2002](试图通过TCP连接://mysql1.ourdomain.com:3306)在/MySQLConnection.php在线29
警告:mysqli_real_connect():(HY000 / 2002):在/MySQLConnection.php在线29
我试着设置:
mysqli_options($db, MYSQLI_OPT_SSL_VERIFY_SERVER_CERT, false);
但是,这并不能帮助。
UPDATE
我说:
$mysql_certs_path = "/full/path/to/certs/mysql";
mysqli_ssl_set($db, $mysql_certs_path . "/client-key.pem", $mysql_certs_path . "/client-cert.pem", $mysql_certs_path . "/ca-cert.pem", null, null);
而仍然得到:
警告:mysqli_real_connect():SSL操作失败,代码1的OpenSSL错误消息:错误:14090086:SSL例程:SSL3_GET_SERVER_CERTIFICATE:证书验证失败在/MySQLConnection.php上线31
Warning: mysqli_real_connect(): Cannot connect to MySQL by using SSL in /MySQLConnection.php on line 31