Qmail and PHP mail fails. Qmail runs fine - how to debug ?!

Ask a Question related to PHP Development, Design and Development.

  1. #1

    Default Qmail and PHP mail fails. Qmail runs fine - how to debug ?!

    We have a problem on a running Qmail server on FreeBSD 5.2.1
    The qmail server runs fine, even with mail injects from the command
    prompt. (see below)

    We compiled PHP 4.3.9 with most options, however we are not quite sure
    we may use --enable-sockets on FreeBSD ? PHP runs on Apache 1.3.x
    and it runs php scripts.

    Additionally when we invoke a testmail.php the page does NOT show up
    and it loops (continue running) in the browser. How can we verify
    what it's doing ? We can't see anything in the logs, as there are no
    established connections due to intern use of the qmail-inject
    function.

    We saw similar problems of this. We want to known the reason of
    the loop.

    Thanks.

    Further details:

    We have a running qmail server running on *:25
    The mailserver succesfull sends mail from our LAN as from localhost.
    Additionally, to be sure, we checked on the command prompt in this
    way : cat test.eml | /var/qmail/bin/qmail-inject

    # test.eml
    Message-ID: <be>
    Date: Wed, 27 Oct 2004 11:00:37 +0200
    From: Me <loc>
    To: root
    Subject: Lokale test

    Mail is received succesfull.

    2) We wrote a test.php to have info on PHP 4.3.9
    <?
    phpinfo();
    ?>

    #Which delivers:

    Configure Command:
    './configure' '--prefix=/usr/local' '--enable-bcmath'
    '--enable-calendar' '--enable-cli' '--enable-ctype' '--enable-dba'
    '--enable-dbx' '--enable-dio' '--enable-exif'
    '--enable-fast-install=yes' '--enable-ftp' '--enable-magic-quotes'
    '--enable-memory-limit' '--enable-overload' '--enable-posix'
    '--enable-session' '--enable-shared=yes' '--enable-short-tags'
    '--enable-sockets' '--enable-static=yes' '--enable-tokenizer'
    '--enable-versioning' '--enable-xslt' '--enable-xml' '--enable-yp'
    '--enable-wddx' '--disable-debug' '--disable-ipv6'
    '--with-curl=/usr/local' '--with-expat-dir=/usr/local'
    '--with-freetype-dir=/usr/local' '--with-gettext=/usr/local'
    '--with-gd' '--enable-gd-native-ttf' '--enable-gd-jis-conv'
    '--with-apache=/usr/local/src/apache_1.3.31' '--with-bz2=/usr/local'
    '--with-config-file-path=/usr/local/etc' '--with-crack=/usr/local'
    '--with-dom=/usr/local' '--with-dom-xslt=/usr/local'
    '--with-dom-exslt=/usr/local' '--with-gettext=/usr/local'
    '--with-iconv=/usr/local' '--with-jpeg-dir=/usr/local'
    '--with-layout=GNU' '--with-ldap=/usr/local'
    '--with-mcrypt=/usr/local'
    '--with-mime-magic=/usr/share/misc/magic.mime'
    '--with-ming=/usr/local' '--with-mysql=/usr/local'
    '--with-mysql-sock=/tmp' '--with-openssl=/usr/local'
    '--with-openssl-dir=/usr/local' '--with-pear=/usr/local/lib/php'
    '--with-pcre-regex=yes' '--with-pgsql=/usr/local'
    '--with-png-dir=/usr/local' '--with-pspell=/usr/local'
    '--with-regex=php' '--with-t1lib=/usr/local'
    '--with-tiff-dir=/usr/local' '--with-tsrm-pthreads'
    '--with-unixODBC=/usr/local' '--with-xmlrpc'
    '--with-xpm-dir=/usr/local' '--with-xslt-sablot=/usr/local'
    '--with-zip=/usr/local' '--with-zlib=yes' '--with-zlib-dir=/usr'
    'i586-jurgys-freebsd5.2.1'

    sendmail_path: /var/qmail/bin/qmail-inject

    3) We wrote a test script to send mail

    #testmail.php
    <?
    error_reporting(E_ALL);
    $result = mail("loc", "Subjet", "Test mail");
    if ( $result )
    {
    echo("Sent");
    }
    else
    {
    echo ("Error");
    }
    ?>

    --

    \I/
    /(@ @)\ Greetings from Jurgy
    ---o00-(_)-00o--------------------
    --

    \I/
    /(@ @)\ Greetings from CyBy
    ---o00-(_)-00o--------------------
    Jurgy Guest

  2. Similar Questions and Discussions

    1. qmail?
      Ok, well I installed qmail and all that jazz through Matt's Mail toaster. Everything appeared to have been installed without any problems,...
    2. QMAIL for AIX
      Hi, For the inherent bugs and complexity with sendmail, I am considering QMAIL for my AIX servers. Has anyone installed QMAIL on AIX, I tried...
    3. php & qmail
      Hi I'm trying to build a program using PHP to increase the performance of Qmail. I'm trying to use PHP to send an email qmail-remote which...
    4. Qmail + PHP
      On Tuesday 05 August 2003 04:07, Haseeb wrote: Yes. -- Jason Wong -> Gremlins Associates -> www.gremlins.biz Open Source Software Systems...
    5. exim, postfix or qmail?
      Hi group, I have a server running woody and currently I'm using exim v3. I have configured procmail and amavis-ng. However, I'm not that content...
  3. #2

    Default Re: Qmail and PHP mail fails. Qmail runs fine - how to debug ?!

    Hello,

    On 10/29/2004 06:56 AM, Jurgy wrote: 

    You may want try this class that comes with a sub-class specialized in
    deliverying via Qmail using qmail-inject. Just let me know if you still
    have problems:

    http://www.phpclasses.org/mimemessage


    --

    Regards,
    Manuel Lemos

    PHP Classes - Free ready to use OOP components written in PHP
    http://www.phpclasses.org/

    PHP Reviews - Reviews of PHP books and other products
    http://www.phpclasses.org/reviews/

    Metastorage - Data object relational mapping layer generator
    http://www.meta-language.net/metastorage.html
    Manuel Guest

  4. #3

    Default Re: Qmail and PHP mail fails. Qmail runs fine - how to debug ?!

    On Fri, 29 Oct 2004 14:48:13 -0300, Manuel Lemos <org>
    wrote:
     
    >
    >You may want try this class that comes with a sub-class specialized in
    >deliverying via Qmail using qmail-inject. Just let me know if you still
    >have problems:
    >
    >http://www.phpclasses.org/mimemessage[/ref]

    Yes I known this class, and I will see if i can embed it.

    However I want to known the source of the problem or I need to update
    a whole bunch of scripts. I can sent mail from one system with the
    same script and I can't do it on the testing server for some reason,
    and I want to find out the source of the problem.
    --

    \I/
    /(@ @)\ Greetings from CyBy
    ---o00-(_)-00o--------------------
    Jurgy Guest

  5. #4

    Default Re: Qmail and PHP mail fails. Qmail runs fine - how to debug ?!

    Hello,

    On 10/29/2004 02:55 PM, Jurgy wrote: 
    >>
    >>You may want try this class that comes with a sub-class specialized in
    >>deliverying via Qmail using qmail-inject. Just let me know if you still
    >>have problems:
    >>
    >>http://www.phpclasses.org/mimemessage[/ref]
    >
    >
    > Yes I known this class, and I will see if i can embed it.
    >
    > However I want to known the source of the problem or I need to update
    > a whole bunch of scripts. I can sent mail from one system with the
    > same script and I can't do it on the testing server for some reason,
    > and I want to find out the source of the problem.[/ref]

    If there is a queueing error, the class will return that error. I am
    afraid that the mail() function may just ignore that. So, just try the
    class and tell me what happens.

    --

    Regards,
    Manuel Lemos

    PHP Classes - Free ready to use OOP components written in PHP
    http://www.phpclasses.org/

    PHP Reviews - Reviews of PHP books and other products
    http://www.phpclasses.org/reviews/

    Metastorage - Data object relational mapping layer generator
    http://www.meta-language.net/metastorage.html
    Manuel Guest

  6. #5

    Default Re: Qmail and PHP mail fails. Qmail runs fine - how to debug ?!

    On Fri, 29 Oct 2004 15:04:40 -0300, Manuel Lemos <org>
    wrote:
     
    >>
    >>
    >> Yes I known this class, and I will see if i can embed it.
    >>
    >> However I want to known the source of the problem or I need to update
    >> a whole bunch of scripts. I can sent mail from one system with the
    >> same script and I can't do it on the testing server for some reason,
    >> and I want to find out the source of the problem.[/ref]
    >
    >If there is a queueing error, the class will return that error. I am
    >afraid that the mail() function may just ignore that. So, just try the
    >class and tell me what happens.[/ref]

    Ok, I took Your class from PHP classes which is indeed nice written.

    a) I deinstalled the whole bunch of PHP 4.3.9 with:
    pkg_delete -x "php4*"
    pkg_delete -x "pecl-*"
    rm -d -r /usr/local/lib/php

    b) Because I would use some php 5 stuff, I installed PHP, but only the
    core from FreeBSD port systems:

    cd /usr/ports/lang/php5
    make WITH_APACHE=yes PHP_SAPI=full
    make WITH_APACHE=yes PHP_SAPI=full install

    I copied php.ini-dist to php.ini
    and i change

    ;sendmail_path

    into

    sendmail_path = /var/qmail/bin/qmail-inject

    I write a test.php file with
    <?
    phpinfo();
    ?>


    c) Some verification of PHP:

    # php -v
    PHP 5.0.2 (cli) (built: Oct 31 2004 11:12:24) (DEBUG)
    Copyright (c) 1997-2004 The PHP Group
    Zend Engine v2.0.2, Copyright (c) 1998-2004 Zend Technologies

    (Ok next time i try WITH_DEBUG=no)

    #php -m
    [PHP Modules]
    libxml
    SPL
    Standard

    #php -f test.php | grep sendmail_path
    sendmail_path => /var/qmail/bin/qmail-inject =>
    /var/qmail/bin/qmail-inject

    (Ok, seems OK)

    d) Some verification of my Qmail server
    I create a test.eml file with:

    <snip>
    Message-ID: <be>
    Date: Wed, 27 Oct 2004 11:00:37 +0200
    From: me <loc>
    To: loc
    Subject: Lokale test

    Helleuu.
    </snip>

    I test Qmail from shell with:
    cat test.eml | /var/qmail/bin/qmail-inject (works)

    e) Your classes to sent mail :
    http://www.phpclasses.org/browse/package/9/download/zip/name/mimemessage-2004-10-11.zip

    I installed those files from Your source:
    * email_message.php
    * qmail_mail.php
    * qmail_message.php
    * test_qmail_mail.php

    I changed the test_qmail_mail.php with me and me2
    And here we go....

    #php -f test_qmail_mail.php

    Same results, the mail hangs and sits waiting.
    No core dumped, it just runs and waits...

    What I saw, in the To field i tried to mail a local user. This errors
    comes (which should be more in detail) :

    Error: the additional parameters that were specified are not supported

    So I presume You need to enter a FULL email. However there are
    such possibilities as user,user+, &user for local users !!!
    besides user@FQDN

    Anyway this does not solve my problem. So my opinion, php tries to
    use the qmail server and waits to have access to it. qmail-inject can
    be executed by others, so I don't see the problem. I think it can't
    connect, but I use internal mail injects. :-/

    So what next ?

    --

    \I/
    /(@ @)\ Greetings from CyBy
    ---o00-(_)-00o--------------------
    Jurgy Guest

  7. #6

    Default Re: Qmail and PHP mail fails. Qmail runs fine - how to debug ?!

    On Sun, 31 Oct 2004 12:34:09 +0100, Jurgy <jurgen reMovE-This-NoSPam
    AT person DOT be> wrote:
     
    >>
    >>If there is a queueing error, the class will return that error. I am
    >>afraid that the mail() function may just ignore that. So, just try the
    >>class and tell me what happens.[/ref]
    >
    >Ok, I took Your class from PHP classes which is indeed nice written.
    >
    >a) I deinstalled the whole bunch of PHP 4.3.9 with:
    >pkg_delete -x "php4*"
    >pkg_delete -x "pecl-*"
    >rm -d -r /usr/local/lib/php
    >
    >b) Because I would use some php 5 stuff, I installed PHP, but only the
    >core from FreeBSD port systems:
    >
    >cd /usr/ports/lang/php5
    >make WITH_APACHE=yes PHP_SAPI=full
    >make WITH_APACHE=yes PHP_SAPI=full install
    >
    >I copied php.ini-dist to php.ini
    >and i change
    >
    >;sendmail_path
    >
    >into
    >
    >sendmail_path = /var/qmail/bin/qmail-inject
    >
    >I write a test.php file with
    ><?
    > phpinfo();
    >?>
    >
    >
    >c) Some verification of PHP:
    >
    ># php -v
    >PHP 5.0.2 (cli) (built: Oct 31 2004 11:12:24) (DEBUG)
    >Copyright (c) 1997-2004 The PHP Group
    >Zend Engine v2.0.2, Copyright (c) 1998-2004 Zend Technologies
    >
    >(Ok next time i try WITH_DEBUG=no)
    >
    >#php -m
    >[PHP Modules]
    >libxml
    >SPL
    >Standard
    >
    >#php -f test.php | grep sendmail_path
    >sendmail_path => /var/qmail/bin/qmail-inject =>
    >/var/qmail/bin/qmail-inject
    >
    >(Ok, seems OK)
    >
    >d) Some verification of my Qmail server
    >I create a test.eml file with:
    >
    ><snip>
    >Message-ID: <be>
    >Date: Wed, 27 Oct 2004 11:00:37 +0200
    >From: me <loc>
    >To: loc
    >Subject: Lokale test
    >
    >Helleuu.
    ></snip>
    >
    >I test Qmail from shell with:
    >cat test.eml | /var/qmail/bin/qmail-inject (works)
    >
    >e) Your classes to sent mail :
    >http://www.phpclasses.org/browse/package/9/download/zip/name/mimemessage-2004-10-11.zip
    >
    >I installed those files from Your source:
    >* email_message.php
    >* qmail_mail.php
    >* qmail_message.php
    >* test_qmail_mail.php
    >
    >I changed the test_qmail_mail.php with me and me2
    >And here we go....
    >
    >#php -f test_qmail_mail.php
    >
    >Same results, the mail hangs and sits waiting.
    >No core dumped, it just runs and waits...
    >
    >What I saw, in the To field i tried to mail a local user. This errors
    >comes (which should be more in detail) :
    >
    >Error: the additional parameters that were specified are not supported
    >
    >So I presume You need to enter a FULL email. However there are
    >such possibilities as user,user+, &user for local users !!!
    >besides user@FQDN
    >
    >Anyway this does not solve my problem. So my opinion, php tries to
    >use the qmail server and waits to have access to it. qmail-inject can
    >be executed by others, so I don't see the problem. I think it can't
    >connect, but I use internal mail injects. :-/
    >
    >So what next ?[/ref]

    Ok I found something, seems it get stuck into the qmail-queue ?! What
    do i need to do ?

    I have a problem with the PHP mail() function on a running Qmail
    server
    on FreeBSD 5.2.1. Pretty like this problem, I found in the mail
    archive :
    http://lists.freebsd.org/pipermail/freebsd-questions/2003-August/017231.html

    Please, can somebody help me out. With this problem and the PHP mail()
    function.

    OS : FreeBSD 5.2.1
    Mailserver: Qmail
    PHP : 5.0.2 (4.3.9 same error)

    Step 1: Testing of the qmail server in shell:

    I create a test.eml file with:
    <snip>
    Message-ID: <be>
    Date: Wed, 27 Oct 2004 11:00:37 +0200
    From: me <loc>
    To: loc
    Subject: Local test

    Helleuu.
    </snip>

    I test the mailserver from shell with:
    cat test.eml | /var/qmail/bin/qmail-inject (mail arrives)
    cat test.eml | /usr/sbin/sendmail -t -i (mail arrives)

    Step 2: I deinstalled the whole bunch of PHP 4.3.9 with:
    pkg_delete -x "php4*"
    pkg_delete -x "pecl-*"
    rm -d -r /usr/local/lib/php /usr/local/include/php

    Step 3: Install minimum PHP system.

    cd /usr/ports/lang/php5
    make WITH_APACHE=yes PHP_SAPI=full
    make WITH_APACHE=yes PHP_SAPI=full install

    Step 4: Configure right php.ini and verify it works

    cp /usr/local/etc/php.ini-dist /usr/local/etc/php.ini

    Change
    ;sendmail_path
    into
    sendmail_path = /var/qmail/bin/qmail-inject

    (note: same behaviour when i use, or I use ; before sendmail)
    sendmail_path = /usr/sbin/sendmail -t -i

    qmail-inject can be accessed and executed from others.

    Write a test.php with
    <?
    phpinfo();
    ?>

    # php -v
    PHP 5.0.2 (cli) (built: Oct 31 2004 11:12:24) (DEBUG)
    Copyright (c) 1997-2004 The PHP Group
    Zend Engine v2.0.2, Copyright (c) 1998-2004 Zend Technologies

    (Ok next time i try WITH_DEBUG=no)

    #php -m
    [PHP Modules]
    libxml
    SPL
    Standard

    #php -f test.php | grep sendmail_path
    sendmail_path => /var/qmail/bin/qmail-inject =>
    /var/qmail/bin/qmail-inject

    (Ok, seems OK)

    Step 5: testing mail from PHP

    A simple test2.php:

    <?
    mail("loc", "Subjet", "Test mail");
    ?>

    #php -f test2.php

    ->Same results, the script sits waiting/running whatever.
    No core dumped, it just runs and waits...

    Step 6: Let the script run and try another session

    ps -aux and i have this:

    (using mailwrapper)
    root 8803 0.0 0.9 6152 3440 p0 I+ 4:44PM 0:00.17 php
    -f test2.php
    root 8804 0.0 0.1 908 332 p0 I+ 4:44PM 0:00.02 sh
    -c /usr/sbin/sendmail -t -i
    root 8805 0.0 0.2 1256 584 p0 I+ 4:44PM 0:00.08
    bin/qmail-inject -H --
    qmailq 8806 0.0 0.1 1224 512 p0 I+ 4:44PM 0:00.04
    bin/qmail-queue

    So the script initiates the wrapper; qmail-inject and qmail-queue)

    (using qmailinject directly from php.ini)
    root 8962 0.0 0.9 6152 3440 p1 I+ 5:00PM 0:00.16 php
    -f testmail.php
    root 8963 0.0 0.1 908 332 p1 I+ 5:00PM 0:00.02 sh
    -c /var/qmail/bin/qmail-inject
    root 8964 0.0 0.2 1256 584 p1 I+ 5:00PM 0:00.03
    /var/qmail/bin/qmail-inject
    qmailq 8965 0.0 0.1 1224 512 p1 I+ 5:00PM 0:00.03
    bin/qmail-queue

    In this case the script initiates qmail-inject directly and
    qmail-queue)

    But why does it stucks, waits and the phpscript keeps running ?

    Step 7: Use qmail-inject directly with printout to screen option

    Change php.ini with
    sendmail_path = /var/qmail/bin/qmail-inject -H -n


    #php -f test2.php
    Return-Path: <my-mail>
    Date: 31 Oct 2004 16:59:51 -0000
    Message-ID: <20041031165951.9252.qmail@mydomain>
    From: mymail
    To: be
    Subject: Subjet



    Test mail

    (and the script does NOT return to the promp)

    Step 8: Verify what's going on with qmail-stat in a seconday shell

    #/var/qmail/bin/qmail-qstat
    messages in queue: 4

    --> when the script is started it is raised +1
    --> when teh script is stopped it is lowered -1

    So the mail get stucks into the queue and refuse to be processed
    further.
    What to do ?!

    --

    \I/
    /(@ @)\ Greetings from CyBy
    ---o00-(_)-00o--------------------
    Jurgy Guest

  8. #7

    Default Re: Qmail and PHP mail fails. Qmail runs fine - how to debug ?!

    Hello,

    On 10/31/2004 08:34 AM, Jurgy wrote: 
    >>
    >>If there is a queueing error, the class will return that error. I am
    >>afraid that the mail() function may just ignore that. So, just try the
    >>class and tell me what happens.[/ref]
    >
    >
    > Ok, I took Your class from PHP classes which is indeed nice written.
    >
    > a) I deinstalled the whole bunch of PHP 4.3.9 with:
    > pkg_delete -x "php4*"
    > pkg_delete -x "pecl-*"
    > rm -d -r /usr/local/lib/php[/ref]

    Did you have the same problem when you tried with PHP 4?

     

    Does it work when you try this:

    cat test.eml | /var/qmail/bin/qmail-inject com

    where com is your message return address, typically the
    of the From: header.


     

    I don't know if FreeBSD has the strace command. If it has something like
    that, you may want to take a look at its output to what is it hanging for.

     
     

    What additional parameters were you passing?

     

    Right, but in the end it must form a full address and it may not be
    possible to figure the complete address from the a partial address for
    instance when you are in safe mode.


     

    My guess is that this is either a PHP 5/FreeBSD specific problem, but
    until you reply to the questions above it will be hard to tell.

    --

    Regards,
    Manuel Lemos

    PHP Classes - Free ready to use OOP components written in PHP
    http://www.phpclasses.org/

    PHP Reviews - Reviews of PHP books and other products
    http://www.phpclasses.org/reviews/

    Metastorage - Data object relational mapping layer generator
    http://www.meta-language.net/metastorage.html
    Manuel Guest

  9. #8

    Default Re: Qmail and PHP mail fails. Qmail runs fine - how to debug ?!

    On Sun, 31 Oct 2004 23:58:58 -0300, Manuel Lemos <org>
    wrote:
     
    >>
    >>
    >> Ok, I took Your class from PHP classes which is indeed nice written.
    >>
    >> a) I deinstalled the whole bunch of PHP 4.3.9 with:
    >> pkg_delete -x "php4*"
    >> pkg_delete -x "pecl-*"
    >> rm -d -r /usr/local/lib/php[/ref]
    >
    >Did you have the same problem when you tried with PHP 4?
    >

    >
    >Does it work when you try this:
    >
    >cat test.eml | /var/qmail/bin/qmail-inject com
    >[/ref]

    Yes, this works.
     
    >
    >I don't know if FreeBSD has the strace command. If it has something like
    >that, you may want to take a look at its output to what is it hanging for.
    >


    >
    >What additional parameters were you passing?[/ref]

    I only pass an internal account in the from Field. Not a FQDN, and
    Qmail appends it plusdomain to it in normal circumstances.
     
    >
    >Right, but in the end it must form a full address and it may not be
    >possible to figure the complete address from the a partial address for
    >instance when you are in safe mode.[/ref]

    Yes, but You can check if You are in safe mode. If You are, You can
    impose a different way of the method, and to give a detailed error
    like "In safe mode, You can use only FQDN for sender and recipients"
    And to allow account, account%, account+ and &account when You
    are not in safe mode.
     
    >
    >My guess is that this is either a PHP 5/FreeBSD specific problem,[/ref]

    No, I have this problem with 4.x too. And I see a similar problem
    here:
    http://lists.freebsd.org/pipermail/freebsd-questions/2003-August/017231.html
     


    I replaced the qmail with postfix. I have the same errors. So this
    has nothing to do with Qmail. The mai() function waits until some
    event to continue the script. When i use the -n (printout) option,
    I can trace the mail is sent to qmail-queue, but the mail() function
    does not resume. Btw do i need to install some extensions to let mail
    work, i have only installed the core, with a minimum of modules ?!

    So to be clear, the qmail-inject is initiated (see bellow), this
    inititiates the qmail-queue and up there is locks up. Maybe the
    qmail-queue does not trigger an end, or the mail script 'forgets' to
    continue and keeps running ? Anyway, if we found the case, You can
    write some code to catch this problem and to give an error. It's
    pretty strange the script keeps running and running.

    Step 1: Let the script run and try another session

    ps -aux and i have this:

    (using mailwrapper)
    root 8803 0.0 0.9 6152 3440 p0 I+ 4:44PM 0:00.17 php
    -f test2.php
    root 8804 0.0 0.1 908 332 p0 I+ 4:44PM 0:00.02 sh
    -c /usr/sbin/sendmail -t -i
    root 8805 0.0 0.2 1256 584 p0 I+ 4:44PM 0:00.08
    bin/qmail-inject -H --
    qmailq 8806 0.0 0.1 1224 512 p0 I+ 4:44PM 0:00.04
    bin/qmail-queue

    So the script initiates the wrapper; qmail-inject and qmail-queue)

    (using qmailinject directly from php.ini)
    root 8962 0.0 0.9 6152 3440 p1 I+ 5:00PM 0:00.16 php
    -f testmail.php
    root 8963 0.0 0.1 908 332 p1 I+ 5:00PM 0:00.02 sh
    -c /var/qmail/bin/qmail-inject
    root 8964 0.0 0.2 1256 584 p1 I+ 5:00PM 0:00.03
    /var/qmail/bin/qmail-inject
    qmailq 8965 0.0 0.1 1224 512 p1 I+ 5:00PM 0:00.03
    bin/qmail-queue

    In this case the script initiates qmail-inject directly and
    qmail-queue)

    But why does it stucks, waits and the phpscript keeps running ?

    Step 2: Use qmail-inject directly with printout to screen option

    Change php.ini with
    sendmail_path = /var/qmail/bin/qmail-inject -H -n


    #php -f test2.php
    Return-Path: <my-mail>
    Date: 31 Oct 2004 16:59:51 -0000
    Message-ID: <20041031165951.9252.qmail@mydomain>
    From: mymail
    To: be
    Subject: Subjet



    Test mail

    (and the script does NOT return to the promp)

    Step 3: Verify what's going on with qmail-stat in a seconday shell

    #/var/qmail/bin/qmail-qstat
    messages in queue: 4

    --> when the script is started it is raised +1
    --> when teh script is stopped it is lowered -1

    So the mail get stucks into the queue and refuse to be processed
    further.
    What to do ?!

    --

    \I/
    /(@ @)\ Greetings from CyBy
    ---o00-(_)-00o--------------------
    CyBy Guest

  10. #9

    Default Re: Qmail and PHP mail fails. Qmail runs fine - how to debug ?!

    Hello,

    On 11/01/2004 06:39 AM, CyBy wrote: 
    >>
    >>Right, but in the end it must form a full address and it may not be
    >>possible to figure the complete address from the a partial address for
    >>instance when you are in safe mode.[/ref]
    >
    >
    > Yes, but You can check if You are in safe mode. If You are, You can
    > impose a different way of the method, and to give a detailed error
    > like "In safe mode, You can use only FQDN for sender and recipients"
    > And to allow account, account%, account+ and &account when You
    > are not in safe mode.[/ref]

    It is not worth the additional code that it takes especially because it
    will not work in all cases and the benefit is just for lazy users.

     
    >>
    >>My guess is that this is either a PHP 5/FreeBSD specific problem,[/ref]
    >
    >
    > No, I have this problem with 4.x too. And I see a similar problem
    > here:
    > http://lists.freebsd.org/pipermail/freebsd-questions/2003-August/017231.html[/ref]

    As I said it seems to be a FreeBSD specific problem of PHP.


     
    >
    >
    >
    > I replaced the qmail with postfix. I have the same errors. So this
    > has nothing to do with Qmail. The mai() function waits until some
    > event to continue the script. When i use the -n (printout) option,
    > I can trace the mail is sent to qmail-queue, but the mail() function
    > does not resume. Btw do i need to install some extensions to let mail
    > work, i have only installed the core, with a minimum of modules ?![/ref]

    You still have not made what I suggested of using an strace utility or
    equivalent in FreeBSD and see where is it hanging.

    You may was compile PHP with debugging information and run a debugger so
    you can see the call stack when it hangs.

    Other than that you may want to look at PHP bug database and report a
    new bug if you do not find anybody reporting a similar problem.

    That is what I would do if I had your problem.

    --

    Regards,
    Manuel Lemos

    PHP Classes - Free ready to use OOP components written in PHP
    http://www.phpclasses.org/

    PHP Reviews - Reviews of PHP books and other products
    http://www.phpclasses.org/reviews/

    Metastorage - Data object relational mapping layer generator
    http://www.meta-language.net/metastorage.html
    Manuel Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139