postfixadmin ignores all config.inc.php files.

2013-05-08
2013-05-09
  • Hi all,

    My mail server is working okay.

    Recently I wanted to use postfixadmin to add a user. All of a sudden I could no longer login. I noticed that my difficulties came from a lack of a valid sql connection to postfixadmin.

    postfixadmin tried to connect to my mysql database as the user "mail@localhost".

    In my config.inc.php files the database is called postfix, the user is called postfix.

    So I thought, maybe postfixadmin is reading another config.inc.php file somewhere else. So i searched the system for these files. I found postfixadmin files in the following locations:

    /var/www/postfixadmin/config.inc.php
    /usr/share/postfixadmin/config.inc.php
    /etc/postfixadmin/config.inc.php
    /var/lib/ucf/cache/:etc:postfixadmin:config.inc.php

    So next I went ahead and changed all these files to the correct database, user and password.

    Guess what, postfixadmin still tried to connect as mail@localhost thus ignoring all the above mentioned configuration files.

    My question: is there a way to set a path to or force postfixadmin to use one of the above files?

    I am running out of answers, and I tried to remove postfixadmin with apt-get autoremove postfixadmin wand reinstall it. I will still not read any of the files.

    Regards, Paul

    P.S. all files are set to configured "false", changing them to "true" did not change anything.

     
    Last edit: Paul Constantine 2013-05-08
  • A quick look at the deb package shows that /usr/share/postfixadmin/config.inc.php is a symlink to /etc/postfixadmin/config.inc.php.

    Since none of them seems to be used, you might have to check it in the code. config.inc.php is included from common.php - check for the exact include path there.

    You might also have a include.local.php which is included after reading config.inc.php and can (and should, by design) override settings in config.inc.php. (Actually I'd recommend to do your settings in config.local.php only.)

     
  • You should be able to see where your "active" postfixadmin is running when you browse to it by checking your postfixadmin apache config file.
    On CentOS (RedHat base) it is in /etc/httpd/conf.d/postfixadmin and look for the alias line (mine only has the one line) which should point you to the location in use. I think Debian based distros use /etc/apache/conf.d/

    cat /etc/httpd/conf.d/postfixadmin.conf
    Alias /postfixadmin /usr/share/postfixadmin

    Christian is correct about the config.local.php, very useful to rather have your config changes in this file as you can then easily upgrade PostfixAdmin without worrying about losing your config settings.

     
  • Thanks a Million. These were very helpful pointers.

    The only file I did not find was the "config.local.php" that you both mentioned. Maybe Ubuntu 10.04 LTS differs from other distros.

    Anyway, it's working again.
    Thank you.

     
    • Hi Paul,
      You just create the config.local.php in the same folder as the config.inc.php but it only needs to contain options that you want different from the defaults as they are in config.inc.php