ID: 49299 User updated by: david at ols dot es Reported By: david at ols dot es Status: Bogus Bug Type: MySQL related Operating System: Linux debian PHP Version: 5.2.10 New Comment:
I have removed the mysql_config that reports the wrong socket, compiled php again (also with --with-mysql-sock=/tmp/mysql.sock ) and tested again and the problem is still the same Previous Comments: ------------------------------------------------------------------------ [2009-08-20 10:27:47] david at ols dot es I found another (ancient) mysql_config which reports the wrong socket, this mysql_config is not the one found by the system (using PATH), so it seems that php is using the wrong mysql_config to get the socket name ------------------------------------------------------------------------ [2009-08-20 10:07:25] david at ols dot es mysql_config correctly reports the socket: [src]# mysql_config --socket /tmp/mysql.sock no change has been made to mysql, no upgrade, no change, nothing, we where only upgrading php, with previous php version all worked ok. in the other hand php cli with -n does not read at all php.ini ------------------------------------------------------------------------ [2009-08-20 09:50:57] j...@php.net By default the socket is that (or whatever mysql_config says it is). If you have changed your mysql configuration, then you need to change it in your php.ini as well. No bug here. ------------------------------------------------------------------------ [2009-08-20 07:01:28] david at ols dot es sorry, the apache module has the same problem, it only works ok if the socket is defined in php.ini by mysql.default_socket = /tmp/mysql.sock , if left empty trying to connect to localhost produces a "Warning: mysql_connect(): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)" error altough phpinfo shows MYSQL_SOCKET /tmp/mysql.sock ------------------------------------------------------------------------ [2009-08-19 20:29:37] david at ols dot es Description: ------------ mysql_connect uses wrong socket Reproduce code: --------------- #!/usr/local/bin/php -n <?php $base="/usr/local/exim"; $lnk=mysql_connect('localhost','root','password'); ?> Expected result: ---------------- script must connect to mysql server Actual result: -------------- Warning: mysql_connect(): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) echo "<?php phpinfo(); ?>" | /usr/local/bin/php -n | grep sock reports: MYSQL_SOCKET => /tmp/mysql.sock mysql.default_socket => no value => no value PHP compiled with ./configure --with-mysql --with-mysql-sock=/tmp/mysql.sock no default socket configured in php.ini Apache module version works ok, but same code executed wiht php cli seems to use a socket defined elsewhere ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=49299&edit=1