Mail() does not function on FreeBSD and PHP and Qmail or Postfix

From: Jurgy (jurgen)
Date: 10/31/04


Date: Sun, 31 Oct 2004 16:05:26 +0100

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: <802973227.20041027110037@person.be>
Date: Wed, 27 Oct 2004 11:00:37 +0200
From: me <me@mydomain.loc>
To: me2@mydomain.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("me@mydomain.loc", "Subjet", "Test mail");
?>

#php -f test2.php

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

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


Relevant Pages

  • Re: Php random text code to work in version 5
    ... Create a php page on your PHP5 server, ... It will give you lots of details about the server configuration. ... Zend Engine v2.1.0, ...
    (alt.php)
  • Re: PHP4 network functions
    ... > I'm pretty sure that this problem has nothing to do with PHP and a whole lot ... > to do with my server config, but I've got no idea where to start. ... > returns an empty array whereas on another server it will return a populated ... Zend Engine v1.3.0, ...
    (comp.lang.php)
  • Re: What are pros any cons to use eaccelerator and zend optimizer on php5?
    ... Server built: Jan 5 2006 11:10:01 ... Copyright 1997-2004 The PHP Group ... Zend Engine v2.0.4-dev, ... with eAccelerator v0.9.3, Copyright 2004-2004 eAccelerator, by eAccelerator ...
    (comp.lang.php)
  • Setting php server
    ... testing my php source code. ... set in lighty. ... If I have an index.html on the server, ... Zend Engine v2.1.0, ...
    (php.general)
  • Re: [PHP] libmm.so.14
    ... Setting up a php based ticket system on a new OpenSuse 10.3 64bit system. ... The ticket sys requires qmail so I had to uninstall postfix and install ... Qmail injects emails into this ticket sys with the following line... ...
    (php.general)