Menu

postfixadmin-cli error

2012-07-01
2013-01-23
  • Manish Kathuria

    Manish Kathuria - 2012-07-01

    I had installed Postfix Admin 2.3.5 on CentOS 6.2 and also the postfixadmin-cli from SVN so that I can add user accounts in bulk using a script. Running postfixadmin-cli at the command prompt gave the following error messages:

    [PHP Warning:  require_once(/var/www/html/postfixadmin-2.3.5/languages/.lang): failed to open stream: No such file or directory in /var/www/html/postfixadmin-2.3.5/common.php on line 48

    Warning: require_once(/var/www/html/postfixadmin-2.3.5/languages/.lang): failed to open stream: No such file or directory in /var/www/html/postfixadmin-2.3.5/common.php on line 48
    PHP Fatal error:  require_once(): Failed opening required '/var/www/html/postfixadmin-2.3.5/languages/.lang' (include_path='.:/usr/share/pear:/usr/share/php') in /var/www/html/postfixadmin-2.3.5/common.php on line 48

    Fatal error: require_once(): Failed opening required '/var/www/html/postfixadmin-2.3.5/languages/.lang' (include_path='.:/usr/share/pear:/usr/share/php') in /var/www/html/postfixadmin-2.3.5/common.php on line 48

    I solved this problem by creating a symlink in the languages directory:

    # ln -s en.lang .lang

    So the above error messages were gone. But now when I run postfixadmin-cli, I get these new error messages:

    PHP Fatal error:  Class 'Config' not found in /var/www/html/postfixadmin-2.3.5/scripts/postfixadmin-cli.php on line 557

    Fatal error: Class 'Config' not found in /var/www/html/postfixadmin-2.3.5/scripts/postfixadmin-cli.php on line 557

    What is the work around for this error ?

    Has someone been able to run postfixadmin-cli successfully ? Or is there any other option / script to add users in bulk through the command line ?

    Thanks,

     
  • Christian Boltz

    Christian Boltz - 2012-07-01

    This sounds like you have 2.3.5 + only the scripts/ directory from trunk. Long story short: this won't work because the CLI depends on several files outside the scripts/ directory.

    You need a complete checkout of SVN trunk to run the CLI.

    If you want, you can keep the 2.3.5 web interface, but you'll have to run setup.php from SVN trunk once to do some database updates (which are backwards-compatible with 2.3.5).

     
  • Manish Kathuria

    Manish Kathuria - 2012-07-01

    Yes you are right. I only have the 2.3.5 and only the scripts from the trunk directory. Can I do a complete checkout on the SVN trunk and upgrade my existing setup to it ? I hope it is as stable and would not cause any issues.

    Thanks,

     
  • Manish Kathuria

    Manish Kathuria - 2012-07-02

    As suggested, I did a complete checkout of SVN trunk and also ran the setup.php once. To test the program, I issued the command

    # postfixadmin-cli mailbox add

    and tried to add an email address for an existing domain. However, now I get the following error:

    PHP Notice:  Undefined offset: 1 in /var/www/html/postfixadmin-svn/model/MailboxHandler.php on line 228

    Notice: Undefined offset: 1 in /var/www/html/postfixadmin-svn/model/MailboxHandler.php on line 228
    Error: This domain does not exist!

    I checked it for a number of domains but I get the same error everytime.

     
  • Christian Boltz

    Christian Boltz - 2012-07-02

    You found a bug - the mailbox CLI still used an outdated syntax of MailboxHandler, which (not surprisingly) failed.

    Please update to latest SVN - it should be fixed there ;-)

    Sidenote: Be warned that the CLI commandline syntax (especially for add) will probably change to something that is more flexible, but also more verbose/lengthly. (I don't know when this will happen - I need some free time to implement it, and free time is very rare ;-)

     
  • Manish Kathuria

    Manish Kathuria - 2012-07-08

    Thanks for your help. Its working now.

    One more thing, I think while adding a mailbox if the domain does not exist, a new domain is created by the CLI. Is it possible to avoid that so that the mailboxes are created only for the domains which have already been created in postfixadmin ?

     
  • Christian Boltz

    Christian Boltz - 2012-07-08

    Huh? The CLI does NOT auto-create domains - at least AFAIK.

    If this really happens for you, can you please post the output of
    ./postfixadmin-cli domain view the_non_existing_domain
    ./postfixadmin-cli mailbox add # create a mailbox at the_non_existing_domain
    ./postfixadmin-cli domain view the_non_existing_domain

     

Log in to post a comment.