|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2011-08-09 13:22 UTC] 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)
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Nov 06 15:00:02 2025 UTC |
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' ));