Bug #53795 [Com]: Connect Error from MySqli (mysqlnd) when using SSL
Edit report at http://bugs.php.net/bug.php?id=53795edit=1 ID: 53795 Comment by: dave dot kelly at dawkco dot com Reported by:dave dot kelly at dawkco dot com Summary:Connect Error from MySqli (mysqlnd) when using SSL Status: Closed Type: Bug Package:MySQLi related Operating System: Windows PHP Version:5.3.5 Assigned To:kalle Block user comment: N Private report: N New Comment: OK, the patch works. Mysqli (mysqlnd build) on Windows can now use SSL/TLS connections. Thank you! Previous Comments: [2011-01-31 13:51:40] ka...@php.net This bug has been fixed in SVN. Snapshots of the sources are packaged every three hours; this change will be in the next snapshot. You can grab the snapshot at http://snaps.php.net/. Thank you for the report, and for helping us make PHP better. [2011-01-31 13:47:31] ka...@php.net Automatic comment from SVN on behalf of kalle Revision: http://svn.php.net/viewvc/?view=revisionamp;revision=307880 Log: Fixed bug #53795 (Connect Error from MySqli (mysqlnd) when using SSL) [2011-01-30 11:35:52] ka...@php.net I got an idea why this fails, as MYSQLND_SSL_SUPPORTED is not defined on Windows, its a simple one line fix that I will commit shortly [2011-01-29 09:36:07] dave dot kelly at dawkco dot com FYI (you probably already know): there are currently no SSL/TLS options available to be set with the mysqli::options method. I tried using the mysqli::ssl_set method as follows, but it didn't work either (same connect error): $mysqli-ssl_set(NULL, // key file path or NULL NULL, // cert file path or NULL 'C:/ssl/ca-cert.pem', // ca cert file path or NULL NULL, // capath directory or NULL 'DHE-RSA-AES256-SHA'); // cipher or NULL Also, tried the following (no luck): $mysqli-ssl_set('C:/ssl/key.pem', // key file path or NULL 'C:/ssl/cert.pem', // cert file path or NULL 'C:/ssl/ca-cert.pem', // ca cert file path or NULL NULL, // capath directory or NULL NULL); // cipher or NULL As noted before, these all work with PHP 5.2.17, but not with PHP 5.3.5. A fix for mysqlnd would be great because trying to do a custom build on Windows with mysqlnd disabled has become a real ordeal. [2011-01-24 11:12:59] and...@php.net No, mysqlnd doesn't use my.ini/my.cnf files, as libmysql did. You have to set your options manually. The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/bug.php?id=53795 -- Edit this bug report at http://bugs.php.net/bug.php?id=53795edit=1
Bug #45900 [Com]: timelib_structs.h include path issue on Windows
Edit report at http://bugs.php.net/bug.php?id=45900edit=1 ID: 45900 Comment by: dave dot kelly at dawkco dot com Reported by:Keisial at gmail dot com Summary:timelib_structs.h include path issue on Windows Status: Bogus Type: Bug Package:Compile Failure Operating System: Windows PHP Version:5.3CVS-2008-08-23 (snap) Assigned To:pajoye Block user comment: N Private report: N New Comment: The status of this bug should not be 'Bogus' (yet anyway). I'm still getting this error with the 5.3.5 (production) source build. .../timelib_structs.h(24) : fatal error C1083: Cannot open include file: 'timelib_config.h': No such file or directory NMAKE : fatal error U1077: 'cl.exe' : return code '0x2' Stop. It appears that the file: C:/php-sdk/php53dev/vc9/x86/php-5.3.5/ext/date/config.w32 is not executing properly during config. At the bottom of .../ext/date/config.w32 is the following: var tl_config = FSO.CreateTextFile(ext/date/lib/timelib_config.h, true); tl_config.WriteLine(#include \config.w32.h\); tl_config.Close(); If this code were executing properly during config, there wouldn't be a problem, but the timelib_config.h file is not being created for some reason. Previous Comments: [2008-09-24 22:45:36] Keisial at gmail dot com Looks it wasn't fixed as it is happening with a clean folder :( Calling configure again after the error it then builds !? php5.3-200809241430 del * /s /q cd .. tar xjf php5.3-200809241430.tar.bz2 cd php5.3-200809241430 buildconf cscript /nologo configure.js nmake snip head.c C:\PROGRA~1\Microsoft Platform SDK\Include\Ws2tcpip.h(593) : warning C4142: benign redefinition of type .\ext/date/lib/timelib_structs.h(24) : fatal error C1083: Cannot open include file: 'timelib_config.h': No such file or directory NMAKE : fatal error U1077: 'cl.exe' : return code '0x2' Stop. nmake head.c C:\PROGRA~1\Microsoft Platform SDK\Include\Ws2tcpip.h(593) : warning C4142: benign redefinition of type .\ext/date/lib/timelib_structs.h(24) : fatal error C1083: Cannot open include file: 'timelib_config.h': No such file or directory NMAKE : fatal error U1077: 'cl.exe' : return code '0x2' Stop. cscript /nologo configure.js nmake builds It doesn't hit the error with --disable-calendar [2008-08-25 18:55:26] paj...@php.net I have discussed with Keisal on IRC and the issue is fixed (clean co and al). [2008-08-25 18:25:53] j...@php.net Is timelib_config.h generated or not when this happens? WHERE is it generated to? Search for it, it might get generated but in a wrong directory.. [2008-08-23 21:28:33] Keisial at gmail dot com You're right. The issue is not the switch style. Why is it always documented with / ? :) The error is: .\ext/date/lib/timelib_structs.h(24) : fatal error C1083: Cannot open include file: 'timelib_config.h': No such file or directory I have gone deeper into it, and is not caused on compiling date but when compiling ext\standard\microtime.c which #include ext/date/php_date.h Interestingly, i only see it with --enable-snapshot-build and running again nmake skips it. [2008-08-23 18:00:54] paj...@php.net -I works like /I There is other extension using the -I (gd, pcre, etc.) without problems. Which error do you get (exactly)? The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/bug.php?id=45900 -- Edit this bug report at http://bugs.php.net/bug.php?id=45900edit=1
Bug #53795 [Asn]: Connect Error from MySqli (mysqlnd) when using SSL
Edit report at http://bugs.php.net/bug.php?id=53795edit=1 ID: 53795 User updated by:dave dot kelly at dawkco dot com Reported by:dave dot kelly at dawkco dot com Summary:Connect Error from MySqli (mysqlnd) when using SSL Status: Assigned Type: Bug Package:MySQLi related Operating System: Windows PHP Version:5.3.5 Assigned To:mysql Block user comment: N Private report: N New Comment: FYI (you probably already know): there are currently no SSL/TLS options available to be set with the mysqli::options method. I tried using the mysqli::ssl_set method as follows, but it didn't work either (same connect error): $mysqli-ssl_set(NULL, // key file path or NULL NULL, // cert file path or NULL 'C:/ssl/ca-cert.pem', // ca cert file path or NULL NULL, // capath directory or NULL 'DHE-RSA-AES256-SHA'); // cipher or NULL Also, tried the following (no luck): $mysqli-ssl_set('C:/ssl/key.pem', // key file path or NULL 'C:/ssl/cert.pem', // cert file path or NULL 'C:/ssl/ca-cert.pem', // ca cert file path or NULL NULL, // capath directory or NULL NULL); // cipher or NULL As noted before, these all work with PHP 5.2.17, but not with PHP 5.3.5. A fix for mysqlnd would be great because trying to do a custom build on Windows with mysqlnd disabled has become a real ordeal. Previous Comments: [2011-01-24 11:12:59] and...@php.net No, mysqlnd doesn't use my.ini/my.cnf files, as libmysql did. You have to set your options manually. [2011-01-24 10:21:41] u...@php.net mysqlnd does not read default files, AFAIK. I think Andrey wants to deprecate that, Andrey? [2011-01-20 01:59:47] dave dot kelly at dawkco dot com Description: - Using PHP 5.3.5 Windows binaries (Zip package). - extension = php_mysqli.dll is enabled in php.ini. - trying to use mysqli::real_connect, passing MYSQLI_CLIENT_SSL in the flags parameter. It returns the following error: Warning: mysqli::real_connect() [mysqli.real-connect.html]: (28000/1045): Access denied for user 'user'@'host' (using password: YES) in C:\Apache22\htdocs\test.php on line 25 Connect Error (1045) If I switch to PHP 5.2.17 Windows binaries (Zip package), using the exact same settings and script, I get the following (excerpts): Success... host via TCP/IP ... Ssl_cipher DHE-RSA-AES256-SHA ... Ssl_version TLSv1 I believe the main difference (relevant to this problem) between PHP 5.2.17 and PHP 5.3.5 is that 5.2.17 uses libmysql.dll and 5.3.5 uses built-in mysqlnd (native driver). So, it appears that libmysql.dll works with SSL, while built-in mysqlnd (native driver) cannot use SSL. The Windows binaries build has no way to disable/enable mysqlnd and/or libmysql. If mysqlnd is not going to work with SSL, there should at least be another option that can be configured at runtime with the options file. Test script: --- ?php $mysqli = new mysqli(); $mysqli-init(); if (!$mysqli-options(MYSQLI_READ_DEFAULT_FILE, 'C:/Program Files/MySQL/my.ini')) { die('Setting MYSQLI_READ_DEFAULT_FILE failed'); } if (!$mysqli-options(MYSQLI_READ_DEFAULT_GROUP, 'mysql')) { die('Setting MYSQLI_READ_DEFAULT_GROUP failed'); } if (!$mysqli-real_connect('host', 'user', 'pass', 'mydb', 3306, NULL, MYSQLI_CLIENT_SSL)) { echo 'Connect Error (' . mysqli_connect_errno() . ')' . br /\n; } else { echo 'Success... ' . $mysqli-host_info . br /\n; $sql = show status like '%ssl%'; $result = $mysqli-query($sql); while ($row = $result-fetch_array()) { echo $row[0] . ' ' . $row[1] . br /\n; } if ($result) { $result-close(); } } $mysqli-close(); ? Expected result: Expect a new SSL connection and a result set from the query indicating that the connection is indeed via SSL/TLS. Actual result: -- Warning: (28000/1045): Access denied ... Connect Error (1045). -- Edit this bug report at http://bugs.php.net/bug.php?id=53795edit=1
[PHP-BUG] Bug #53795 [NEW]: Connect Error from MySqli (mysqlnd) when using SSL
From: Operating system: Windows PHP version: 5.3.5 Package: MySQLi related Bug Type: Bug Bug description:Connect Error from MySqli (mysqlnd) when using SSL Description: - Using PHP 5.3.5 Windows binaries (Zip package). - extension = php_mysqli.dll is enabled in php.ini. - trying to use mysqli::real_connect, passing MYSQLI_CLIENT_SSL in the flags parameter. It returns the following error: Warning: mysqli::real_connect() [mysqli.real-connect.html]: (28000/1045): Access denied for user 'user'@'host' (using password: YES) in C:\Apache22\htdocs\test.php on line 25 Connect Error (1045) If I switch to PHP 5.2.17 Windows binaries (Zip package), using the exact same settings and script, I get the following (excerpts): Success... host via TCP/IP ... Ssl_cipher DHE-RSA-AES256-SHA ... Ssl_version TLSv1 I believe the main difference (relevant to this problem) between PHP 5.2.17 and PHP 5.3.5 is that 5.2.17 uses libmysql.dll and 5.3.5 uses built-in mysqlnd (native driver). So, it appears that libmysql.dll works with SSL, while built-in mysqlnd (native driver) cannot use SSL. The Windows binaries build has no way to disable/enable mysqlnd and/or libmysql. If mysqlnd is not going to work with SSL, there should at least be another option that can be configured at runtime with the options file. Test script: --- ?php $mysqli = new mysqli(); $mysqli-init(); if (!$mysqli-options(MYSQLI_READ_DEFAULT_FILE, 'C:/Program Files/MySQL/my.ini')) { die('Setting MYSQLI_READ_DEFAULT_FILE failed'); } if (!$mysqli-options(MYSQLI_READ_DEFAULT_GROUP, 'mysql')) { die('Setting MYSQLI_READ_DEFAULT_GROUP failed'); } if (!$mysqli-real_connect('host', 'user', 'pass', 'mydb', 3306, NULL, MYSQLI_CLIENT_SSL)) { echo 'Connect Error (' . mysqli_connect_errno() . ')' . br /\n; } else { echo 'Success... ' . $mysqli-host_info . br /\n; $sql = show status like '%ssl%'; $result = $mysqli-query($sql); while ($row = $result-fetch_array()) { echo $row[0] . ' ' . $row[1] . br /\n; } if ($result) { $result-close(); } } $mysqli-close(); ? Expected result: Expect a new SSL connection and a result set from the query indicating that the connection is indeed via SSL/TLS. Actual result: -- Warning: (28000/1045): Access denied ... Connect Error (1045). -- Edit bug report at http://bugs.php.net/bug.php?id=53795edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=53795r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=53795r=trysnapshot53 Try a snapshot (trunk): http://bugs.php.net/fix.php?id=53795r=trysnapshottrunk Fixed in SVN: http://bugs.php.net/fix.php?id=53795r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=53795r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=53795r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=53795r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=53795r=needscript Try newer version: http://bugs.php.net/fix.php?id=53795r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=53795r=support Expected behavior: http://bugs.php.net/fix.php?id=53795r=notwrong Not enough info: http://bugs.php.net/fix.php?id=53795r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=53795r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=53795r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=53795r=php4 Daylight Savings:http://bugs.php.net/fix.php?id=53795r=dst IIS Stability: http://bugs.php.net/fix.php?id=53795r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=53795r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=53795r=float No Zend Extensions: http://bugs.php.net/fix.php?id=53795r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=53795r=mysqlcfg