I am running PHP 5.0.4 and MySQL 4.1.3a. (+Apache 2.0.54) When I run a
PHP script that attempts to connect to MySQL I get the following

Database ERROR:Can't connect to local MySQL server through socket
'/usr/local/mysql/tmp/mysql.sock' (13)

I have placed my socket file on such location when I was configuring
MySQL and PHP was compiled with
--with-mysql-sock=/usr/local/mysql/tmp/mysql.sock (and even with
/usr/local/mysql/tmp). I even edited my php.ini
(/usr/local/php/lib/php.ini, I have installed PHP with
--prefix=/usr/local/php) and modified variable:

mysql.default_socket = "/usr/local/mysql/tmp/mysql.sock"

It still refuses to connect through the socket! I have also run a
simple mysql_connect() script to see if the intended script was the
culprit but again, it could not connect to MySQL.

phpinfo() indicates the following:

MYSQL_SOCKET    /usr/local/mysql/tmp/mysql.sock
MYSQL_INCLUDE   -I/usr/local/mysql/include/mysql
MYSQL_LIBS      -L/usr/local/mysql/lib/mysql -lmysqlclient

And for directives:
mysql.default_port      no value        no value
mysql.default_socket    /usr/local/mysql/tmp/mysql.sock 

That being said, I "CAN" connect to the database via ""
through TCP/IP but not through Unix Socket file. The permissions on
mysql.sock is:

ls -la /usr/local/mysql/tmp/
total 0
drwxrwx---   2 mysql mysql  80 2005-08-24 22:09 ./
drwxr-xr-x  13 root  mysql 328 2005-08-22 20:03 ../
srwxrwxrwx   1 mysql mysql   0 2005-08-24 22:09 mysql.sock=

Again, I can connect to DB through other programs (non-php) or via
commandline and even TCP but not through Unix socket file!!

Any ideas?

PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to