#41778 [NEW]: Always get the SSL connection error

From: Date: Fri, 22 Jun 2007 08:37:23 +0000
Subject: #41778 [NEW]: Always get the SSL connection error
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-114079@lists.php.net to get a copy of this message
From:             mail at tobia-wassermann dot de
Operating system: Windows XP
PHP version:      5.2.3
PHP Bug Type:     MySQLi related
Bug description:  Always get the SSL connection error

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 bug report at http://bugs.php.net/?id=41778&edit=1
-- 
Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=41778&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=41778&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=41778&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=41778&r=fixedcvs
Fixed in release:             http://bugs.php.net/fix.php?id=41778&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=41778&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=41778&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=41778&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=41778&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=41778&r=notwrong
Not enough info:              http://bugs.php.net/fix.php?id=41778&r=notenoughinfo
Submitted twice:              http://bugs.php.net/fix.php?id=41778&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=41778&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=41778&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=41778&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=41778&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=41778&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=41778&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=41778&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=41778&r=mysqlcfg


Thread (12 messages)

« previous php.bugs (#114079) next »