PHP MySQL Authanticating with File User Owner

kelepirci

Member
Aug 27, 2006
5
0
151
Hello all,

One of our VPS customer's cPanel installed VPS server is having very strange error. They complained about php database connection problem. When I invastigate the problem I have realised following error:

Code:
Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'nobody'@'localhost' (using password: NO) in /home/gunesank/public_html/test2.php on line 2
Could not connect: Access denied for user 'nobody'@'localhost' (using password: NO)
First, I tought this a simple MySql authantication error, but it was not. As you can see on abow, nobody user triying to authanticate @ localhost. nobody user is the file owner. If I change the file owner to simon the error message will change as follow:

Code:
Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'siom'@'localhost' (using password: NO) in /home/gunesank/public_html/test2.php on line 2
Could not connect: Access denied for user 'simon'@'localhost' (using password: NO)
Is anyone has come across with such strange problem?:confused:
 

kelepirci

Member
Aug 27, 2006
5
0
151
I am definitly sure. The DB user and password are correct and proper permissions for the user has been granted.
 

kelepirci

Member
Aug 27, 2006
5
0
151
Yes, I am very sure and I have double checked. The user and dtabase has been created with cPanel and proper permissions are granted from cPanel.

You can be sure that this is not a simple authantication issue. This is more than that :D
 
Last edited:

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,884
2,254
463
Hello :)

Please check if the following option is enabled in the /usr/local/lib/php.ini file:

Code:
sql.safe_mode
If this option is enabled, please disable it and restart Apache. When this option is enabled, MySQL will try to use the cPanel username without a password for all database connections and not try to use the script's actual MySQL username and password for the connection.

Thank you.