ID: 23492
User updated by: dziugas dot baltrunas at m-1 dot lt
Reported By: dziugas dot baltrunas at m-1 dot lt
-Status: Feedback
+Status: Open
Bug Type: MySQL related
Operating System: FreeBSD 4.8-RELEASE
PHP Version: 4.3.1
New Comment:
here is snip from phpinfo() about mysql:
MySQL Support enabled
Active Persistent Links 0
Active Links 0
Client API version 4.0.12
MYSQL_MODULE_TYPE external
MYSQL_SOCKET /tmp/mysql.sock
MYSQL_INCLUDE -I/usr/local/include/mysql
MYSQL_LIBS -L/usr/local/lib/mysql -lmysqlclient
mysql servers lives not in the same place webserver does. earlier php
was compiled with 3.23.55 client library, then I decided to compile it
with 4.0.12. it didn't make sense. I'm not sure it's PHP bug natively,
but I'm mainly curious about why it "fails to use password" ?
one more thing to say - these systems are loaded enough, i.e.
mysqladmin reports 15.968 queries per second, so I said before, it's
hard to repeat this error in, to say, normal conditions.
Previous Comments:
------------------------------------------------------------------------
[2003-05-05 16:25:21] sniper@php.net
What makes you think it's PHP bug, and not bug in the
fairly new Mysql4 ?? Did this happen with Mysql 3.23.xx ?
Are you using the bundled mysql library or did you compile
PHP with the mysql4 client library? Check your phpinfo()
output for mysql section for the API version.
Does this happen with CLI or with some server module?
------------------------------------------------------------------------
[2003-05-05 09:43:12] dziugas dot baltrunas at m-1 dot lt
As I said, seems like password retrieval makes no difference. I have
connectdb() function which look like this:
function connectdb() {
global $mysql_host, $mysql_user, $mysql_pass, $dbid;
$dbid = mysql_connect( $mysql_host, $mysql_user, $mysql_pass);
if(!$dbid) {
$file = fopen("/tmp/mysql-err", "a+");
$line = $_SERVER['PHP_SELF'] . ":" . date("Y-m-d H:i:s");
$line .= ":$mysql_host:$mysql_user:$mysql_pass - $dbid:" .
mysql_error() . "\n";
fputs($file, $line);
fclose($file);
}
return $dbid;
}
and here is what gets logged into /tmp/mysql-err:
/index.php:2003-05-05 14:30:53:db1.m-1.lan:public:secret - :Access
denied for user: 'public@10.10.12.254' (Using password: NO)
so function retrieves the password fine.
------------------------------------------------------------------------
[2003-05-05 09:29:18] nicos@php.net
Thanks for the report.
Do you retrieve your password from any dynamic way or is it static?
------------------------------------------------------------------------
[2003-05-05 08:54:22] dziugas dot baltrunas at m-1 dot lt
We are currently using MySQL 4.0.12. This bug occurs occasionaly and
there is no way to guess what makes it appear. Even if there are
"hardcoded" username and password into the function, i.e. not passing
variables to it, like mysql_connect("mysql.host", "public", "secret"),
PHP reports Warning:
[05-May-2003 14:06:17] PHP Warning: mysql_connect() [<a
href='http://www.php.net/function.mysql-connect'>function.mysql-connect</a>]:
Access denied for user: 'public@10.10.12.254' (Using password: NO) in
/var/www/sala.lt/htdocs/skundai/classes/db.php on line 10
So the problem is that warning (or mysql_error() message) about not
using password is not correct.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=23492&edit=1