What I did is made a symlink from /var/run/mysql.sock to /tmp/mysql.sock
example: ln -s /var/run/mysql.sock /tmp/mysql.sock
Or if /var/run/mysql.sock doesn't exist, find / -name "mysql.sock"
Then symlink that to /tmp
Hope that helps.
----- Original Message -----
From: "Ellis M. Mendez-Hidaka" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, March 08, 2002 8:43 PM
Subject: [PHP] mysql_connect() help
> Greetings,
> I'm a newbie with apache and PHP.
> I was able to setup apache, php and mysql in RH Linux and have my
> website running.
> I was trying to test the BD connectivity capabilities of PHP but I keep
> receiving this error message:
> {
> Warning: Can't connect to local MySQL server through socket
> '/tmp/mysql.sock' (2) in /var/www/html/testdb.php on line 20
>
> Warning: MySQL Connection Failed: Can't connect to local MySQL server
> through socket '/tmp/mysql.sock' (2) in /var/www/html/testdb.php on line
> 20
> Could not connect to DB
> }
>
> I tried looking at the documentation in php.net, but I don't see what
> could be the problem.
> Here is the code (line 20 is the mysql_connect() command):
>
> <?php
>
>
>
> //build SELECT query
> $query = "SELECT * FROM divers";
>
> //Connect to MySQL
> // *************This line is the problem! :^( ******************
> if( !($database1 = mysql_connect( "localhost","test1","psswd" ) ) )
> die( "Could not connect to DB" );
>
> //Open database
> if( !mysql_select_db( "divers", $database1 ) )
> die( "Could not open divers DB" );
>
> //Query DB
> if( !($result = mysql_query( $query, $databse1 ) ) )
> {
> print("Could not execute query! <br />" );
> die( mysql_error() );
> }
>
> ?>
>
> My DB is running fine, and I even tested it with that ID and it shows
> fine as well.....
>
> I'm using PHP 4.0.6 and mysql is enabled.
> Am I missing any settings I might not know?
> Any help will be really appreciated.
> Thank you
>
> Ellis
>
>
> --
> 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