I am new to this list today, so if I should be sending this to another specific PHP list, please let me know. I am getting the following error via the PHP web page I am building:
Warning: mysql_connect(): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (13) in /var/www/html/software/index.php on line 18 Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (13)
Here are lines 12-19 in my index.php file in which I am trying to establish a mysql connection:
<?php $hostname = "localhost"; $username = "softread"; $password = "XXXXXXX"; // XXXX'd out for list only $dbname = "software"; mysql_connect($hostname, $username, $password) or die(mysql_error()); mysql_select_db($dbname) or die(mysql_error());
I am running this on a RH ES 3.0, using PHP 4.3.2, and MySQL 5.0.27. I CAN connect to MySQL via the following commands:
# mysql -usoftread -p software
AND
# mysql --socket=/var/lib/mysql/mysql.sock -usoftread -pXXXXXX software
I can also connect to the MySQL database via the web using webmin. And here are the php.ini configurations for MySQL:
mysql.allow_persistent = On mysql.max_persistent = -1 mysql.max_links = -1 mysql.default_port = 3306 mysql.default_socket = mysql.default_host = localhost mysql.default_user = mysql.default_password = mysql.connect_timeout = -1 mysql.trace_mode = Off
From googling the error message and reading the suggestions of others, I think I've covered all of my bases. What else do I need to look at that could be causing this problem? I've had a person who is used to configuring servers to use PHP and MySQL look at this and he also thinks I've got it setup correctly. Help!
Thanks, Tim
-- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php