PHP5: Initial connection to the MySQL server is carried out using

PHP5: Initial connection to the MySQL server is carried out using

am 20.02.2009 17:24:44 von Paul Will

Hi,

When I attempt to connect to a MySQL database I have noticed that the
initial connection is made using the "wwwrun" userid (this is the userid
that my Apache2 webserver is running under.)


This is the output I see from the Firefox "View Frame Info Function"

Notice: Undefined index: db in /srv/www/htdocs/LMsummary.php5 on line
23


Notice: Undefined index: user in /srv/www/htdocs/LMsummary.php5 on line 24


Notice: Undefined index: pass in /srv/www/htdocs/LMsummary.php5 on line 25


Notice: Undefined index: host in /srv/www/htdocs/LMsummary.php5 on line 26


Warning: mysql_connect(): Access denied for user 'wwwrun'@'localhost'
(using password: NO) in /srv/www/htdocs/LMsummary.php5 on line 28

Unable to connect to MySQL server, check userid and password are correct.


However when I examine the values passed to the PHP script used in the mysql_connect()
function I find that they are correct and as they should be, and it appears that for
some reason details of the wwwrun userid is being passed to the mysql database prior
to the correct ones. Is this normal?

I should state that subsequent to this error the PHP connection to the MySQL server
proceeds normally and the database is read OK and the pages are correctly compiled.
The phpinfo() function also shows that the indexes apparently contain the correct values.

Thanks in advance for any help.

Paul Will


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

Re: PHP5: Initial connection to the MySQL server is carried out using the apache webserver userid

am 20.02.2009 17:48:50 von Sean DeNigris

On Feb 20, 2009, at 11:24 AM, Paul Will wrote:

> Hi,
>
> When I attempt to connect to a MySQL database I have noticed that the
> initial connection is made using the "wwwrun" userid (this is the
> userid
> that my Apache2 webserver is running under.)
>
>
> This is the output I see from the Firefox "View Frame Info Function"
>
> Notice: Undefined index: db in /srv/www/htdocs/LMsummary.php5 on line
> 23
>

>

>
> Warning: mysql_connect(): Access denied for user 'wwwrun'@'localhost'
> (using password: NO) in /srv/www/htdocs/LMsummary.php5 on line 28
>
Unable to connect to MySQL server, check userid and password
> are correct.
>
> However when I examine the values passed to the PHP script used in
> the mysql_connect()
> function I find that they are correct and as they should be, and it
> appears that for
> some reason details of the wwwrun userid is being passed to the
> mysql database prior
> to the correct ones. Is this normal?
>
> I should state that subsequent to this error the PHP connection to
> the MySQL server
> proceeds normally and the database is read OK and the pages are
> correctly compiled.
> The phpinfo() function also shows that the indexes apparently
> contain the correct values.

It would be helpful if you posted the actual connection code (with the
credentials dummied out obviously). Otherwise, we all can only guess
what's going on :)

The DB issue: If the values are not being properly passed to the
connect function, php will use default values, but post the code if
you need more support...

Index issue: index problem probably refers to using global variables
e.g. $_GET. I googled "php list Notice: Undefined index:" and got http://www.dmxzone.com/go?13811
as my first hit. Check it out to see if that fits.

For faster, easier results next time, search your error on Google
first - you may get an easy answer to a common question and avoid
waiting for a response on the list.

Cheers!

Sean DeNigris
sean@clipperadams.com

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

Re: PHP5: Initial connection to the MySQL server is carriedout using the apache webserver userid

am 22.02.2009 22:41:42 von dmagick

Paul Will wrote:
> Hi,
>
> When I attempt to connect to a MySQL database I have noticed that the
> initial connection is made using the "wwwrun" userid (this is the userid
> that my Apache2 webserver is running under.)
>
>
> This is the output I see from the Firefox "View Frame Info Function"
>
> Notice: Undefined index: db in /srv/www/htdocs/LMsummary.php5 on line
> 23
>

> Notice: Undefined index: user in /srv/www/htdocs/LMsummary.php5 on line 24
>

> Notice: Undefined index: pass in /srv/www/htdocs/LMsummary.php5 on line 25
>

> Notice: Undefined index: host in /srv/www/htdocs/LMsummary.php5 on line 26

Fix these errors and it'll probably connect as the right user.

You're trying to access part of an array that doesn't exist, like this:

$db = array();
mysql_connect($db['host'], $db['user'], $db['pass']);


--
Postgresql & php tutorials
http://www.designmagick.com/


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