View Full Version : Access denied for user 'apache' after moving to new host

23 Apr 2008, 01:06

I am having a weird problem that just started after moving web hosts.

I am getting "Access denied for user 'apache'@'xx.xx.xx.xx' (using password: NO)" error displayed at the very top of ONLY the index.php page. No other page displays this error message.

it is important to note that my DB is not hosted on the local host, and the forums work fine other then that one message that is displayed. There are no htaccess files, nor php.ini system settings that have a default DB Host stated. I also have two other VB Sites on this same server and none of them are having this issue, All using the same remote database server (with different Databases).

Here is the top few lines of the header - the error message is displayed before even the html tag is rendered.

Access denied for user 'apache'@'xx.xx.xx.xx' (using password: NO)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html dir="ltr" lang="en">
<!-- no cache headers -->
<meta http-equiv="Pragma" content="no-cache" />
<meta http-equiv="Expires" content="-1" />
<meta http-equiv="Cache-Control" content="no-cache" />
<!-- end no cache headers -->
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<meta name="generator" content="vBulletin 3.6.8" />

One thing I did notice is that this header says I have vBulletin 3.6.8 when I really have vBulletin 3.6.9, not sure if that is relevant.

My previous web host was a windows 2003 server, using php5 and mysql 4.1 - and this problem did not occur. My new host is a Centos5 x86_64 host using php5 and mysqli library with mysql 5.0 - and now this problem occurs. PHP Safe mode is not enabled.

I have tried setting error reporting to none, and have also tried disabling all installed products and both do not help.

Any assistance would be appreciated.

Marco van Herwaarden
23 Apr 2008, 09:11
If you only get it on a single page, then it is probably not because of the vBulletin configuration. My guess is that there is a modification installed that has the MySQL user/pass hardcoded.

23 Apr 2008, 13:36
It was plugin "Haggis Top Poster" that was causing the message to display. Once I disabled that Plugin the error message went away.

This is the plugin code that caused my error message problem.

$rows = 10;
$query="select * from " . TABLE_PREFIX . "user ORDER BY posts desc limit $rows";
echo mysql_error();

$test .= "<a href='member.php?u=$nt[userid]'>$nt[username]</a> ($nt[posts]), ";

24 Apr 2008, 07:38
Use this code instead:
$users = $vbulletin->db->query_read("

while ($user = $vbulletin->db->fetch_array($users))
$test .= '<a href="member.php?u=' . $user['userid'] . '">' . $user['username'] . '</a> (' . $user['posts'] . '), ';