ID: 41778
User updated by: mail at tobias-wassermann dot de
Reported By: mail at tobias-wassermann dot de
-Status: No Feedback
+Status: Open
Bug Type: MySQLi related
Operating System: Windows XP
-PHP Version: 5.2.3
+PHP Version: 5.2.5
Assigned To: andrey
New Comment:
Hi,
reconstructed the case again - sorry for the delay - with the following
code:
<?php
error_reporting(E_ALL);
ini_set("display_errors", "1");
$conn = mysqli_init();
$conn->ssl_set("C:/proj/test/test.crt", "C:/proj/test/ca.crt",
"C:/proj/test/ca2.crt", NULL, NULL);
$conn->real_connect("www.iba-ag.com", "user", "pass", "db", 3306, NULL,
MYSQLI_CLIENT_SSL);
echo $conn->errno;
$res = $conn->query("SELECT * FROM catalog");
echo " - COUNT: {$res->num_rows}";
?>
The big BUT: Everytime I connect, I got a connection and the correct
count of the SELECT - it works if the ssl-files exists or not exists. So
it seems to be that never ever a ssl-connection will be established now
- whats the problem?
I tried this with a 5.2.3 PHP on Windows and a 5.2.5 PHP on Linux - in
both cases with enabled OpenSSL-support
Previous Comments:
------------------------------------------------------------------------
[2008-01-31 01:00:01] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
------------------------------------------------------------------------
[2008-01-23 13:22:27] [EMAIL PROTECTED]
Could you please try to use the full path instead of just giving the
file name? Thanks.
I can't get that error message.
------------------------------------------------------------------------
[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