Edit report at https://bugs.php.net/bug.php?id=55385&edit=1
ID: 55385
Comment by: dnsdns at gmail dot com
Reported by: fuxa_kos at unihost dot cz
Summary: mysqlnd doesn't connect using ssl
Status: Open
Type: Bug
Package: MySQL related
Operating System: Linux
PHP Version: 5.3.6
Block user comment: N
Private report: N
New Comment:
Using PDO Mysql compiled with mysqlnd it doesnt work, if I recompile it with
libmysql the same code works.
It seems mysqlnd doesnt use the supplied keys and doesnt initiate ssl.
I am using PHP 5.3.8
$DB = new PDO("mysql:host=hostname;dbname=ssltest", 'test','mypass', array(
PDO::MYSQL_ATTR_SSL_KEY => '/path/client-key.pem',
PDO::MYSQL_ATTR_SSL_CERT => '/path/client-cert.pem',
PDO::MYSQL_ATTR_SSL_CA => '/path/cacert.pem'
));
Previous Comments:
------------------------------------------------------------------------
[2011-08-11 13:27:41] fuxa_kos at unihost dot cz
PHP compiled by same way (and same OS and Mysql RPM's) with mysqlnd __can__
connect from Mysql 5.5 box to 5.1. But from 5.1 to 5.5 with mysqlnd __can not__
(but with libmysql works fine) - as I reported.
------------------------------------------------------------------------
[2011-08-11 13:20:12] fuxa_kos at unihost dot cz
sry, box where I wrote that works fine haven't mysqlnd. When PHP is compiled
with mysqlnd (at this same box) doesn't work too.
I confirm for mysqlnd return
real_connect: false
var_dump($mirm->connect_error); var_dump($mirm->connect_errno);
NULL
int(0)
------------------------------------------------------------------------
[2011-08-11 13:12:26] fuxa_kos at unihost dot cz
returns
connect_error: NULL
connect_errno: int(0)
I test it from other box with same OS and Mysql 5.1, works fine! But difference
this box have Mysql-server with have_openssl = YES. First case haven't Mysql
server.
I can test it from another box, with PHP from Zend Server CE, then give
additional fdb.
------------------------------------------------------------------------
[2011-08-10 15:21:37] [email protected]
And what is the value of $mirm->connect_error and $mirm->connect_errno? The
error and errno is not populated for connection errors, so thats why they are
blank
------------------------------------------------------------------------
[2011-08-09 13:22:16] fuxa_kos at unihost dot cz
Description:
------------
mysqlnd doesn't connect using ssl, see Test script
PHP compiled with
'--with-mysql=/usr' \
'--with-mysqli=/usr/bin/mysql_config' \
works fine
but with
'--with-mysql=mysqlnd' \
'--with-mysqli=mysqlnd' \
doesn't work. from phpinfo mysqlnd part:
SSL supported
Connect via mysql client works fine too
mysql --ssl-ca=mysql-cacert.pem --ssl-cert=client-cert.pem
--ssl-key=client-key.pem -h some-mysql-55-server
Local client and libraries are
MySQL-client-community-5.1.58-1.rhel5
MySQL-devel-community-5.1.58-1.rhel5
MySQL-shared-compat-5.5.15-1.rhel5
and same problem with
MySQL-shared-compat-5.1.58-1.rhel5
Target Mysql server (and all libraries and bin's) is 5.5.13.
System: CentOS release 5.6 (Final) in up2date state
Linux camel5 2.6.18-238.19.1.el5 #1 SMP Fri Jul 15 07:31:24 EDT 2011 x86_64
x86_64 x86_64 GNU/Linux
Test script:
---------------
var_dump($mirm = mysqli_init());
var_dump($mirm->ssl_set('client-key.pem', 'client-cert.pem',
'mysql-cacert.pem', null, null));
var_dump($mirm->real_connect('some-mysql-55-server', ...));
var_dump($mirm->error);
var_dump($mirm->errno);
Expected result:
----------------
this is working result from mysql legacy driver
object(mysqli)#3 (17) {
["affected_rows"]=>
NULL
["client_info"]=>
string(6) "5.1.58"
["client_version"]=>
int(50158)
["connect_errno"]=>
int(0)
["connect_error"]=>
NULL
["errno"]=>
int(0)
["error"]=>
string(0) ""
["field_count"]=>
NULL
["host_info"]=>
NULL
["info"]=>
NULL
["insert_id"]=>
NULL
["server_info"]=>
NULL
["server_version"]=>
NULL
["sqlstate"]=>
NULL
["protocol_version"]=>
NULL
["thread_id"]=>
NULL
["warning_count"]=>
NULL
}
bool(true)
bool(true)
string(0) ""
int(0)
Actual result:
--------------
this is failed result from mysqlnd driver
object(mysqli)#3 (17) {
["affected_rows"]=>
NULL
["client_info"]=>
string(50) "mysqlnd 5.0.8-dev - 20102224 - $Revision: 308673 $"
["client_version"]=>
int(50008)
["connect_errno"]=>
int(0)
["connect_error"]=>
NULL
["errno"]=>
int(0)
["error"]=>
string(0) ""
["field_count"]=>
NULL
["host_info"]=>
NULL
["info"]=>
NULL
["insert_id"]=>
NULL
["server_info"]=>
NULL
["server_version"]=>
NULL
["sqlstate"]=>
NULL
["protocol_version"]=>
NULL
["thread_id"]=>
NULL
["warning_count"]=>
NULL
}
bool(true)
bool(false) !!!!!!
string(0) ""
int(0)
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=55385&edit=1