Figure out where your mysql.sock file is and provide the path right in your mysql_connect() call. "mysqladmin version" tells you the path.
-Rasmus On Sat, 23 Mar 2002, Jim Hankins wrote: > I'm doing a simple database connection using the follow syntax: > > <html> > <head> > <title>Book-O-Rama Search Results</title> > </head> > <body> > <h1>Book-O-Rama Search Results</h1> > <? > if (!$searchtype || !$searchterm) > { > echo "You have not entered search details. Please go back and try > again."; > exit; > } > > $searchtype = addslashes($searchtype); > $searchterm = addslashes($searchterm); > > @ $db = mysql_pconnect("localhost", "bookorama", "bookorama123"); > > if (!$db) > { > echo "Error: Could not connect to database. Please try again later."; > exit; > } > > When I go to the search page and hit submit (after removing the @ to see an > error on the mysql_pconnect line) > I get Warning: Can't connect to local MySQL server through socket > '/tmp/mysql.sock' (2) in /home/jhankins/public_html/mydirectory/results.php > on line 17 > > I can telnet to the host and with the same username and password access the > database tables etc. What gives? I'm using > 4.0.6 of PHP and apache under Redhat Linux 7.2. Mysql is working fine from > command line and remote via odbc? > > Also tryed mysql_connect with same problem. > > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php