ID: 49299
Updated by: [email protected]
Reported By: david at ols dot es
-Status: Open
+Status: Bogus
Bug Type: MySQL related
Operating System: Linux debian
PHP Version: 5.2.10
New Comment:
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.
Previous Comments:
------------------------------------------------------------------------
[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