Req #38144 [Asn->Csd]: mysqli_real_connect
| From: | fjanisze@php.net | Date: | Thu, 13 Apr 2017 13:13:14 +0000 |
| Subject: | Req #38144 [Asn->Csd]: mysqli_real_connect | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-208524@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=38144&edit=1
ID: 38144
Updated by: fjanisze@php.net
Reported by: traufeisen@php.net
Summary: mysqli_real_connect
-Status: Assigned
+Status: Closed
Type: Feature/Change Request
Package: MySQLi related
Operating System: CentOS 4
PHP Version: 5CVS-2006-07-19 (CVS)
Assigned To: mysql
Block user comment: N
Private report: N
New Comment:
This problem is not reproducible anymore in recent releases, NULL can be submitted as username/pass
and the config file will be then used.
Previous Comments:
------------------------------------------------------------------------
[2011-01-06 15:05:43] uw@php.net
I'm no fan of it. mysqlnd does not support client config files anyway.
------------------------------------------------------------------------
[2006-07-19 15:30:27] traufeisen@php.net
Description:
------------
Hi,
the mysql client libs allow using a user specified "my.cnf".
Such a configfile can already be set with mysqli_options and MYSQLI_READ_DEFAULT_FILE.
The configfile can contain a password for connections. Such a password is only read, if the
password-parameter to the mysql_real_connect c-function is NULL.
Passing NULL as password to mysqli_real_connect gets converted to an empty string during
zend_parse_method_parameters, so the configfile is not used for a password.
At http://www.phpschlampe.de/mysqli.patch is a
tiny patch to allow NULL-values for the password. This patch is against 5.2.
After patching the following works:
<?php
$mysqli = mysqli_init();
mysqli_options($mysqli,MYSQLI_READ_DEFAULT_FILE,"/path/to/.my.cnf");
/*pass NULL as user/pass so that the values in the config-file are used*/
mysqli_real_connect($mysqli,"foo.bar.de",NULL,NULL);
?>
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=38144&edit=1