每个证书都在mysql服务器中正确设置,另一个应用程序在服务器上运行没有问题,只是配置客户端密钥,我只是使用MAMP进行测试,这是我的代码:
$mysqlh = mysqli_init();
mysqli_options ($mysqlh, MYSQLI_OPT_SSL_VERIFY_SERVER_CERT, false);
$mysqlh->ssl_set('/path/to/mysql/client-key.pem', '/path/to/mysql/client-cert.pem', '/path/to/mysql/ca-cert.pem', NULL, NULL);
$this->dbh = mysqli_real_connect($mysqlh, $dbhost, $dbuser, $dbpassword, NULL, NULL, NULL, MYSQL_CLIENT_SSL );
我已经读过,显然我需要禁用服务器证书验证,因为它是自签名的,但是这些php版本中没有可用的标志,任何想法?这是我得到的错误:
[01-Jun-2018 21:26:10 UTC] PHP Warning: mysqli_real_connect(): SSL: Connection reset by peer in /Applications/MAMP/htdocs/FMSCOMM/wp-includes/wp-db.php on line 382
[01-Jun-2018 21:26:10 UTC] PHP Warning: mysqli_real_connect(): Cannot connect to MySQL by using SSL in /Applications/MAMP/htdocs/FMSCOMM/wp-includes/wp-db.php on line 382