php & mysql: strange behavior

twinkel

Verified User
Joined
Dec 5, 2007
Messages
7
Hello,

My other problems seem to fit in this larger scheme, so I'm starting a new thread.

I have a debian 4.0 with DA & custombuild. PHP can't connect to the database.

The following script:
PHP:
<?php
        $dbName = "someuser_db";
        $dbPass = "somepassword";
        $dbUserName = "someuser";
        $host = "localhost";
        $db = mysql_connect($host, $dbUserName, $dbPass) or die ("Could not connect");
        mysql_select_db($dbName,$db);
?>
Gives the following error output:
Code:
Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'someuser'@'localhost' (using password: NO) in /home/someuser/domains/somedomain.tld/public_html/connection.php on line 7
Could not connect

The user can connect (with password) to the database from the command line. PHP seems to ignore the specifiekd password and only tries without a password.

But it does not end there: the username is also ignored by php: it is always set to the filesystem-owner of the PHP file. I can chown the user to "someuser2" and the error message will contain "someuser2". :confused:

And to make it completely weird: for testing purposes I have set up a mysql user without a password. I have chowned the file to that user, so PHP should (for an unknown reason) connect as that user, and (for an unknown reason) without a password.
This should work, and it does work from the command line. PHP however still can't connect to the database :eek:




Please help, I really don't understand it anymore
 
Back
Top