#49299 [Opn]: misconfigured socket on php cli
| From: | david at ols dot es | Date: | Thu, 20 Aug 2009 07:01:31 +0000 |
| Subject: | #49299 [Opn]: misconfigured socket on php cli | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-141271@lists.php.net to get a copy of this message | ||
ID: 49299
User updated by: david at ols dot es
Reported By: david at ols dot es
Status: Open
Bug Type: MySQL related
Operating System: Linux debian
PHP Version: 5.2.10
New Comment:
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
Previous Comments:
------------------------------------------------------------------------
[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