ID: 41778
Updated by: [EMAIL PROTECTED]
Reported By: mail at tobias-wassermann dot de
-Status: Open
+Status: Assigned
Bug Type: MySQLi related
Operating System: Windows XP
PHP Version: 5.2.3
-Assigned To:
+Assigned To: andrey
Previous Comments:
------------------------------------------------------------------------
[2007-06-22 08:37:23] mail at tobias-wassermann dot de
Description:
------------
If I want to connect via SSL to my MySQL-Server, mysqli_real_connect
always returns this error:
Warning: mysqli::real_connect() [function.mysqli-real-connect]:
(HY000/2026): SSL connection error in
C:\proj\wampp\htdocs\test\db\mysql_ssl.php on line 7
I use mysqli_init(), to init the mysqli-object and then use ssl_set()
to set the SSL-stuff and then real_connect().
A connect with the mysql-command-line client and the ssl-ca-option
works perfect - i get a ssl encrypted connection.
Reproduce code:
---------------
Start MySQL-Server with:
mysqld-nt.exe --ssl --ssl-ca=ca.crt --ssl-cert=server.crt
--ssl-key=server.pem <other params>
[The key is not secured by any password or such things]
Use the MySQL-Client from another machine to connect via ssl:
mysql.exe -u test -h server --ssl-ca=ca.crt
Check if SSL works with command line client:
mysql> SHOW STATUS LIKE 'Ssl_cipher';
+---------------+--------------------+
| Variable_name | Value |
+---------------+--------------------+
| Ssl_cipher | DHE-RSA-AES256-SHA |
+---------------+--------------------+
1 row in set (0.02 sec)
It works. Now my PHP code:
<html>
<body>
<?php
$conn = mysqli_init();
$conn->ssl_set(NULL, NULL, "ca.crt", NULL, NULL);
$conn->real_connect("server", "root", NULL, "iba", 3306, NULL,
MYSQLI_CLIENT_SSL);
?>
</body>
</html>
Expected result:
----------------
The real_connect()-call should connect via SSL to the MySQL-Server.
Actual result:
--------------
real_connect() doesn't connect, returns error message:
Warning: mysqli::real_connect() [function.mysqli-real-connect]:
(HY000/2026): SSL connection error in
C:\proj\wampp\htdocs\test\db\mysql_ssl.php on line 7
I know, HY000/2026 is a MySQL error - but the command line connect with
same user and same CA-Certificate works fine. I tested it also on other
machines.
The error occurs if the db-server is another machine as the webserver -
and also occurs if it's the same pc. The problem also exists if i
provide a client-certificate and key to the ssl_set()-function
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=41778&edit=1