postfixadmin database access error

Discussion in 'Installation/Configuration' started by yupinho, Oct 10, 2007.

  1. yupinho

    yupinho New Member

    Hi all!

    I'm trying to set up postfixadmin to manage the mailboxes but I get an error when I try to create a new domain. The error is "The domain already exists!" even if the database is empty.
    I went to the logs and I found apache user trying to access the postfixadmin database which is not supposed to happen.

    [Wed Oct 10 15:40:41 2007] [error] [client 192.168.2.122] PHP Warning: mysql_real_escape_string() [<a href='function.mysql-real-escape-string'>function.mysql-real-escape-string</a>]: Access denied for user 'apache'@'localhost' (using password: NO) in /var/www/html/postfixadmin/functions.inc.php on line 131, referer: http://192.168.2.253/postfixadmin/admin/create-domain.php
    [Wed Oct 10 15:40:41 2007] [error] [client 192.168.2.122] PHP Warning: mysql_real_escape_string() [<a href='function.mysql-real-escape-string'>function.mysql-real-escape-string</a>]: A link to the server could not be established in /var/www/html/postfixadmin/functions.inc.php on line 131, referer: http://192.168.2.253/postfixadmin/admin/create-domain.php

    This happens using mysql database_type in config.inc.php and if I use mysqli the logs change to:

    [Wed Oct 10 15:49:15 2007] [error] [client 192.168.2.122] PHP Warning: mysqli_real_escape_string() expects exactly 2 parameters, 1 given in /var/www/html/postfixadmin/functions.inc.php on line 132, referer: http://192.168.2.253/postfixadmin/admin/create-domain.php

    I tried to uninstall postfixadmin and then reinstall it and still the same.

    Any hints?
     
  2. falko

    falko Super Moderator Howtoforge Staff Moderator HowtoForge Supporter ISPConfig Developer

    Did you set the correct database user in config.inc.php?
     
  3. yupinho

    yupinho New Member

    Yes, as the machine is still just for testing I didn't even changed the defaults.
    And I find it weird that in the logs the user trying to connect the database is apache...

    // Database Config
    // mysql = MySQL 3.23 and 4.0
    // mysqli = MySQL 4.1
    // pgsql = PostgreSQL
    $CONF['database_type'] = 'mysql';
    $CONF['database_host'] = 'localhost';
    $CONF['database_user'] = 'postfixadmin';
    $CONF['database_password'] = 'postfixadmin';
    $CONF['database_name'] = 'postfix';
    $CONF['database_prefix'] = '';
     
  4. edufl13

    edufl13 New Member

    canĀ“t login

    Hi,

    I think i got the same error:

    Using php 5.3.2 and 5.0.45-Debian_1

    There must be an error or use of outdated functions in the mysql connection strings.
    On my System neither mysql nor mysqli work :(
     
    Last edited: Oct 17, 2007
  5. riicoo

    riicoo New Member

    same problem here

    I have this same problem as yupinho described.

    My setting is a little different though.
    My mail server Postfix and database server MySQL runs on a Debian 4
    My Webserver is Slackware 12.0 with PHP 5.2.3, Apache 2.2.4, and Postfixadmin (newest version as of Oct 2007)
    Connecting to mysql server from the webserver with user postfix or postfixadmin with no problem after changing the
    bind_address=127.0.0.1
    to
    bind_address=192.168.0.2 #lan ip of the mysql server
    in /etc/mysql/my.cnf

    Setting of config.inc.php in postfixadmin is as follow:
    =======================================
    // Database Config
    // mysql = MySQL 3.23 and 4.0
    // mysqli = MySQL 4.1
    // pgsql = PostgreSQL
    $CONF['database_type'] = 'mysql';
    $CONF['database_host'] = '192.168.0.2'; //ip of the mysql server
    $CONF['database_user'] = 'postfixadmin';
    $CONF['database_password'] = 'secret';
    $CONF['database_name'] = 'postfix';
    $CONF['database_prefix'] = '';
    =======================================

    I believe this is due to platform problem because I just had postfixadmin set up and run with no problem on a SuSE 10.2 system.
     
  6. asyadiqin

    asyadiqin New Member

    Possible Fix For This Error

    I assumed you had magic_quotes turn off, which is why you are getting this error. I had similar error and found that the problem is that function is not connecting to the database before running the SQL command.

    To fix this, refer to this post :-
    http://www.howtoforge.com/forums/showthread.php?t=21930
     

Share This Page