#51026 [Opn->Asn]: ssl not working
ID: 51026
Updated by: pajoye@php.net
Reported By: fuxa_kos at unihost dot cz
-Status: Open
+Status: Assigned
Bug Type: MySQLi related
Operating System: Linux
PHP Version: 5.3.3-dev
-Assigned To:
+Assigned To: mysql
Previous Comments:
------------------------------------------------------------------------
[2010-02-12 21:46:16] fuxa_kos at unihost dot cz
In my case, tested at latest CentOS 5 and 4. All 64-bit boxes, PHP
compiled myself from sources. With Mysql 5.0.89, 5.0.90, 5.1.42.
------------------------------------------------------------------------
[2010-02-12 21:39:48] fuxa_kos at unihost dot cz
same problem
phpinfo()
PHP Version => 5.3.3-dev
# ssl_set
mysqli::ssl_set(): invalid object or resource mysqli
var_dump returns NULL
# real_connect, without MYSQLI_CLIENT_SSL
error: mysqli::real_connect(): (28000/1045): Access denied for
user '...' (using password: YES)
errno: 1045
# real_connect, with MYSQLI_CLIENT_SSL
error: mysqli::real_connect(): (HY000/2003): Can't connect to MySQL
server on '...' (113)
errno: 2003
------------------------------------------------------------------------
[2010-02-12 16:14:01] jani@php.net
Please try using this snapshot:
http://snaps.php.net/php5.3-latest.tar.gz
For Windows:
http://windows.php.net/snapshots/
------------------------------------------------------------------------
[2010-02-12 13:02:55] fuxa_kos at unihost dot cz
Description:
------------
ssl connection not working, same code with 5.2.12 working well.
With reference to bug 49234, I have support [33] => ssl_set.
mysql client working well too.
mysql ... --ssl-ca=cert/mysql-cacert.pem
--ssl-cert=cert/client-cert.pem --ssl-key=cert/client-key.pem
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 116395
Server version: 5.0.90-community-log MySQL Community Edition (GPL)
mysql> SHOW STATUS LIKE 'Ssl_cipher';
+---------------+--------------------+
| Variable_name | Value |
+---------------+--------------------+
| Ssl_cipher | DHE-RSA-AES256-SHA |
+---------------+--------------------+
1 row in set (0.00 sec)
from phpinfo
mysqli
MysqlI Support => enabled
Client API library version => 5.1.42
Active Persistent Links => 0
Inactive Persistent Links => 0
Active Links => 0
Client API header version => 5.1.42
MYSQLI_SOCKET => /var/lib/mysql/mysql.sock
Directive => Local Value => Master Value
mysqli.allow_local_infile => Off => Off
mysqli.allow_persistent => On => On
mysqli.default_host => no value => no value
mysqli.default_port => 3306 => 3306
mysqli.default_pw => no value => no value
mysqli.default_socket => no value => no value
mysqli.default_user => no value => no value
mysqli.max_links => Unlimited => Unlimited
mysqli.max_persistent => Unlimited => Unlimited
mysqli.reconnect => Off => Off
Client is Mysql 5.1 and server is Mysql 5.0. But same for 5.0 Mysql
client. In case PHP 5.2 Mysql client is 5.0.
Reproduce code:
---------------
<?php
ini_set('display_errors', 1);
error_reporting(E_ALL);
$mysqli = mysqli_init();
$mysqli->ssl_set('./cert/client-key.pem', './cert/client-cert.pem',
'./cert/mysql-cacert.pem', null, null);
$mysqli->real_connect('removed', '', '', '');
if ($r = $mysqli->query("SHOW STATUS LIKE 'Ssl_cipher'")) {
var_dump($r->fetch_row());
}
echo $mysqli->error."\n";
echo $mysqli->errno."\n";
Expected result:
----------------
something like this for Ssl_cipher
array(2) {
[0]=>
string(10) "Ssl_cipher"
[1]=>
string(18) "DHE-RSA-AES256-SHA"
}
and no errors.
Actual result:
--------------
Warning: mysqli::ssl_set(): invalid object or resource mysqli
with MYSQLI_CLIENT_SSL
Can't connect to MySQL server on 'removed' (113)
errno = 2003
without MYSQLI_CLIENT_SSL
Warning: mysqli::real_connect(): (28000/1045): Access denied for
user 'removed' (using password: YES)
errno = 1045
ssl_set() in this case returns NULL, not true as doc says.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=51026&edit=1
Thread (8 messages)