php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #45273 Unable to make SSL connection to MySQL DB using mysqli::real_connect
Submitted: 2008-06-14 23:21 UTC Modified: 2008-07-29 01:00 UTC
Votes:3
Avg. Score:4.3 ± 0.5
Reproduced:3 of 3 (100.0%)
Same Version:0 (0.0%)
Same OS:2 (66.7%)
From: luciandipeso at yahoo dot com Assigned: uw (profile)
Status: No Feedback Package: MySQLi related
PHP Version: 5.2.6 OS: OS X, FreeBSD
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: luciandipeso at yahoo dot com
New email:
PHP Version: OS:

 

 [2008-06-14 23:21 UTC] luciandipeso at yahoo dot com
Description:
------------
When I supply the MYSQLI_CLIENT_SSL flag to mysqli::real_connect, the 
script hangs until I either:
get a 500 response from the web server (tested on a shared host running 
FreeBSD)
or simply get a "Server unexpectedly dropped the connection" response 
(tested on my MacBook Pro running OS X 10.4.11).
 
I am able to connect fine via command line.

I looked in my Apache logs, and found no entries.

Reproduce code:
---------------
$db = new mysqli();
$db->init();
		
$db->ssl_set('/path/to/key.pem', '/path/to/cert.pem', '/path/to/ca.pem', NULL, NULL);

$db->real_connect('1.2.3.4', 'login', 'pass', 'database', 3167, '', MYSQLI_CLIENT_SSL);

$query = $db->query("SHOW STATUS");
while($row = $query->fetch_assoc()) {
	print_r($row);
	echo('<br /><br />');
}


Expected result:
----------------
An SSL enabled connection to a remote MySQL database.

Actual result:
--------------
Either a 500 response or a "Server unexpectedly dropped the connection" 
response.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-06-14 23:22 UTC] luciandipeso at yahoo dot com
-- Should say "When I supply the MYSQLI_CLIENT_SSL flag to 
mysqli::real_connect, the 
script hangs until it either" not "I either" :)
 [2008-06-19 18:51 UTC] luciandipeso at yahoo dot com
I'm starting to think that the problem is that mysqli_ssl_set() is not 
working -- no certs are being specified, and so when PHP tries to 
connect over SSL to MySQL, it just hangs.
 [2008-07-14 19:39 UTC] uw@php.net
Please check if your report is a duplicate of http://bugs.php.net/bug.php?id=41778 . Kick out the web server and try a command line script. If its a duplicate, which I guess, we can close this one.
 [2008-07-14 20:15 UTC] luciandipeso at yahoo dot com
I'm not sure what you mean by "kick out the web server and try a command 
line script."

I am able to connect to MySQL using SSL from the command line, but I 
haven't tried PHP CLI if that's what you mean.

I'm not sure if this is a duplicate bug -- in #41778, the person 
actually gets an error returned. For me, the script just hangs until it 
times out and I get a 500 status code.

I've also tried specifying the SSL certs in a my.cnf file, and skipping 
the $db->ssl_set call, but that doesn't work either.
 [2008-07-14 20:57 UTC] jani@php.net
Kick out webserver == use PHP CLI..
 [2008-07-16 21:57 UTC] uw@php.net
Yes, I'm asking if you can reproduce is using a CLI script. The idea is to break the problem down into smaller pieces. Your current setup consists of web server plus PHP. Would be cool if you could provide an example where no web server is involved.

Code 500 sounds like internal server error and a crash or something similar. Ideally we would skip debugging the web server. If not, :-(, what does the web server log say... anything helpful?

Ulf




 [2008-07-16 22:18 UTC] luciandipeso at yahoo dot com
I checked my MySQL and Apache logs, and neither had anything. :-(

I'll try CLI in a little bit.

I don't always get a 500 -- it depends on the server. On my MacBook Pro 
(running Apache 1.x), I just get a message saying the server 
"unexpectadly dropped the connection". On a FreeBSD server running 
Apache (not sure which version), I get a 500.

I believe the FreeBSD is running PHP under FCGI, while my Mac is using 
mod_, so that might explain the difference.
 [2008-07-21 20:23 UTC] jani@php.net
Please, try with CLI.
 [2008-07-29 01:00 UTC] 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".
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 14:01:32 2024 UTC