Re: mysql_connect won't when run from web server

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: Steven A. DuChene
Date:  
To: Main PLUG discussion list
Subject: Re: mysql_connect won't when run from web server
Also I am getting nothing in my mysql.log file but I do get the following
in my apache error_log:

[Sun May 24 15:43:52 2009] [error] [client 127.0.0.1] PHP Warning: mysql_connect() [<a href='function.mysql-connect'>function.mysql-connect</a>]: Can't connect to MySQL server on 'Mysql' (13) in /home/minime/public_html/testmysqlconnect_script.php on line 6

-----Original Message-----
>From: "Steven A. DuChene" <>
>Sent: May 24, 2009 3:53 PM
>To:
>Subject: mysql_connect won't when run from web server
>
>Hello all:
>I have a php to mysql database connection script that I am having a problem with.
>I have two systems. One is running apache and also happens to be my desktop system.
>Call this one system Apache. The other system is running mysql and let's call this
>one Mysql.
>
>the connection script is very simple:
>
>    <?php
>    $dbhost = "Mysql";
>    $dbuser = "someuser";
>    $dbpass = "NOTREAL";

>
>    $conn = mysql_connect($dbhost, $dbuser, $dbpass) or die("Error connecting to mysql");

>
>    if ($conn) {
>    echo "CONNECT OK";
>    }

>
>    $dbname = "tmp";
>    mysql_select_db($dbname);
>    ?>

>
>
>If I run this script from the command line on the Apache system like so:
>
>$ php testmysqlconnect_script.php
>
>and it works fine. However if I run the script from the web browser open on the
>Apache desktop and point it at http://localhost/~meuser/testmysqlconnect_script.php
>I get a connection error. Just to confirm I have also used the following mysql
>command from the command line on the Apache system and it works fine as well:
>
>mysql --host=Mysql -u someuser -p tmp
>
>and entered the exact same user name as is in my script and I am able to connect
>just fine. I have tried looking at the output from php_info() on the Apache web
>server and it looks normal but I could be missing something.
>
>Anyone have any ideas of what I might be over looking???
>--
>Steve DuChene
>
>
>---------------------------------------------------
>PLUG-discuss mailing list -
>To subscribe, unsubscribe, or to change your mail settings:
>http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss




---------------------------------------------------
PLUG-discuss mailing list -
To subscribe, unsubscribe, or to change your mail settings:
http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss