#32081 [Csd->Opn]: mysqli_real_connect(): mysqli.default_socket in php.ini has no effect

From: Date: Wed, 07 Sep 2005 22:40:52 +0000
Subject: #32081 [Csd->Opn]: mysqli_real_connect(): mysqli.default_socket in php.ini has no effect
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-84665@lists.php.net to get a copy of this message
ID: 32081 User updated by: subscription at nazarenko dot net Reported By: subscription at nazarenko dot net -Status: Closed +Status: Open Bug Type: MySQLi related Operating System: Linux SuSE 9.3 (64bit) -PHP Version: 5.0.4 +PHP Version: 5.0.5 and 5.1 CVS New Comment: Sorry, you comment is not true. Both mysql*_connect functions, if called this way: mysql_connect('','user','password') mysqli_connect('','user','password') do use mysql*.default_host/mysql*.default_socket from the php.ini. See my example with mysqli_connect() above. It is ONLY mysqli_real_connect() called this way: mysqli_real_connect($db_obj, '', 'user', 'password') that does not use the values from php.ini. Just to dismiss the argument completely I have tried setting all mysqli.default_* parameters in the php.ini to proper values (safe mode off) and then calling mysqli_real_connect() this way: $db=mysqli_init(); mysqli_real_connect($db); I am still connection error and see that the mysqli_real_connect() is trying to use the hard-coded socket value, which is different from the php.ini Previous Comments: ------------------------------------------------------------------------ [2005-09-07 13:48:21] sniper@php.net The defaults are only used if you don't pass any parameters to these connect functions. ------------------------------------------------------------------------ [2005-09-07 11:40:00] subscription at nazarenko dot net Tried the php5-200509070630 snapshot. The settings in the php.ini file are: error_reporting = E_ALL display_errors = On mysqli.default_socket = "/srv/mysql/mysql.sock" mysqli.default_host = localhost Used this code for testing: <? $db = mysqli_connect('','user','password'); var_dump($db); close ($db); echo "---------------------------\n"; $dbr = mysqli_init(); var_dump (mysqli_real_connect ($dbr, '', 'user', 'password')); mysqli_close($dbr); ?> This produces the following ouput: object(mysqli)#1 (0) --------------------------- Warning: mysqli_real_connect(): (HY000/2002): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) bool(false) So it confirms that mysqli_real_connect() is still ignoring the php.ini setting. ------------------------------------------------------------------------ [2005-09-05 23:38:14] sniper@php.net Please try using this CVS snapshot: http://snaps.php.net/php5-latest.tar.gz For Windows: http://snaps.php.net/win32/php5-win32-latest.zip ------------------------------------------------------------------------ [2005-09-05 15:36:55] subscription at nazarenko dot net I have to reopen this bug. mysqli_connect() treats the mysqli.default_socket OK. mysqli_real_connect() still takes the hardcoded value and ignores the php.ini setting ------------------------------------------------------------------------ [2005-02-25 01:00:01] iliaa@php.net This bug has been fixed in CVS. 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. ------------------------------------------------------------------------ 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/32081 -- Edit this bug report at http://bugs.php.net/?id=32081&edit=1

« previous php.bugs (#84665) next »