Edit report at http://bugs.php.net/bug.php?id=38144&edit=1

 ID:                 38144
 Updated by:         u...@php.net
 Reported by:        traufei...@php.net
 Summary:            mysqli_real_connect
-Status:             Open
+Status:             Assigned
 Type:               Feature/Change Request
 Package:            MySQLi related
 Operating System:   CentOS 4
 PHP Version:        5CVS-2006-07-19 (CVS)
-Assigned To:        
+Assigned To:        mysql
 Block user comment: N
 Private report:     N

 New Comment:

I'm no fan of it. mysqlnd does not support client config files anyway.


Previous Comments:
------------------------------------------------------------------------
[2006-07-19 15:30:27] traufei...@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 http://bugs.php.net/bug.php?id=38144&edit=1

Reply via email to