#1  
Old 3rd April 2008, 01:56
asyadiqin asyadiqin is offline
Senior Member
 
Join Date: Jul 2006
Posts: 120
Thanks: 0
Thanked 1 Time in 1 Post
Default Postfixadmin MySQL Access Error

I used to have this error before but I have somehow forgotten how I resolved it the last time. Hope someone can assist with this.

I have install Postfixadmin and everything seems to look fine. However, when I tried to add domain using the Postfixadmin admin page, I keep getting the following errors.

Quote:
Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: Access denied for user 'apache'@'localhost' (using password: NO) in /home/myGroup/domainname.co.uk/user/htdocs/postfixadmin/functions.inc.php on line 131

Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: A link to the server could not be established in /home/myGroup/domainname.co.uk/user/htdocs/postfixadmin/functions.inc.php on line 131
I have already configured the file config.inc.php and everything seems to be in order. However, if you look at the error, you will notice that Postfixadmin is actually trying to connect to the MySQL server as "apache" instead of as "postfixadmin" which is what was configured in config.inc.php.

Any idea how to resolve this and why this is happening?
Reply With Quote
Sponsored Links
  #2  
Old 3rd April 2008, 02:25
asyadiqin asyadiqin is offline
Senior Member
 
Join Date: Jul 2006
Posts: 120
Thanks: 0
Thanked 1 Time in 1 Post
 
Default Fixed!!

I managed to recall how I fixed it the last time so I hope this would be useful to anyone who tried to use Postfixadmin with magic_quotes turned off.

Open functions.inc.php and go to line 126.

Find this
Quote:
function escape_string ($string)
{
global $CONF;
if (get_magic_quotes_gpc () == 0)
{
if ($CONF['database_type'] == "mysql") $escaped_string = mysql_real_escape_string ($string);
if ($CONF['database_type'] == "mysqli") $escaped_string = mysqli_real_escape_string ($string);
if ($CONF['database_type'] == "pgsql") $escaped_string = pg_escape_string ($string);
}
else
{
$escaped_string = $string;
}
return $escaped_string;
}
Add this 1 line

Quote:
$link = db_connect();
Now the code will look like this

Quote:
function escape_string ($string)
{
global $CONF;
if (get_magic_quotes_gpc () == 0)
{
$link = db_connect();
if ($CONF['database_type'] == "mysql") $escaped_string = mysql_real_escape_string ($string);
if ($CONF['database_type'] == "mysqli") $escaped_string = mysqli_real_escape_string ($string);
if ($CONF['database_type'] == "pgsql") $escaped_string = pg_escape_string ($string);
}
else
{
$escaped_string = $string;
}
return $escaped_string;
}
Now it should work.
Reply With Quote
The Following User Says Thank You to asyadiqin For This Useful Post:
falko (3rd April 2008)
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Management/system config/settings & /server/settings not working!! dactor Installation/Configuration 9 6th February 2008 09:11
Installation Error, Debian 3.1 yogi183 Installation/Configuration 6 23rd February 2007 16:11
Error during installation on Debian 3, AMD64 processor nikola021 Installation/Configuration 1 6th October 2006 09:16
PHP error chrno Installation/Configuration 2 7th September 2006 13:27
Install stop at uuwish, UUDeview SeaWolf Installation/Configuration 6 4th October 2005 23:53


All times are GMT +2. The time now is 20:14.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.