php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #28294 mail() always returns false, even on success
Submitted: 2004-05-06 05:57 UTC Modified: 2004-05-07 17:52 UTC
From: roguedragon at merging dot org Assigned:
Status: Not a bug Package: Mail related
PHP Version: 4.3.6 OS: FreeBSD 4.9-RELEASE
Private report: No CVE-ID: None
 [2004-05-06 05:57 UTC] roguedragon at merging dot org
Description:
------------
I've seen multiple bugs were reported about this in the past, but all were using older versions of PHP, and most were said to be fixed or had patches that were entered into the CVS for the next version. But, here I am with the problem.

On the server listed above (FreeBSD 4.9-RELEASE/Apache 1.3.29/PHP 4.3.6), --enable-sigchild was used in compilation. (There was a patch posted about 

On a simple mail script, the mail() function always returns false, even though the mail is actually going through. (Script posted below)

After reading through the bug reports, I recompiled without the --enable-sigchild flag and rebooted everything. phpinfo() no longer states that it was compiled with --enable-sigchild, but the problem still exists.

I tested the same script on another server that was compiled with --enable-sigchild, and had the same results. mail() returned false even though it sent the email out. (FreeBSD 4.8-RELEASE/Apache 1.3.27/PHP 4.3.2)

On a server that was NOT compiled with --enable-sigchild (FreeBSD 4.9-RELEASE/Apache 1.3.29/PHP 4.3.4), mail() returned the correct status.

Any suggestions?

Reproduce code:
---------------
<?php
if( mail( 'xxx@xxx.xxx', 'test subject', 'just a test message', "From: 'me@mine.com' ) )
    echo "Success";
else
    echo "Failed.";
?>



Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-05-06 06:52 UTC] roguedragon at merging dot org
After fighting with this some more, I finally decided to try another reinstall. This time I used mm from the FreeBSD ports collection, added the "--enable_memory_limit=yes" flag, kept the "--enable-sigchild" flag off, and deleted the php4 directory out of apache-build-dir/src/modules. 

Tested again, and this time it worked. Hopefully this bug listing can help someone else out that has the same problems though.
 [2004-05-06 09:18 UTC] derick@php.net
Ok, so it's not a bug at all.
 [2004-05-06 20:02 UTC] roguedragon at merging dot org
Well, it kindof is a bug. A patch had been added in a while back to fix the sigchild problems, but apparently, it doesn't/no-longer works. Trying to get sigchild completely out and letting functions such as mail() to return the correct values is another hair-pulling experience as well.

If anyone is willing to look into this some more, I'm willing to help out as much as I can. I have at least three other servers that were compiled with sigchild, running multiple releases of the same OS, along with a few servers that were not compiled with it.  If not, please just close the bug and I'll move on my merry way, and just add into my personal notes not to use "--enable-sigchild" on webservers I install.

Thanks
 [2004-05-06 20:21 UTC] wez@php.net
You should only use --enable-sigchild if you are using the oracle client libraries.
 [2004-05-07 17:52 UTC] iliaa@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

--enable-sigchild prevents checking of the return code 
provided by opened pipes. 
 
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Sun Aug 14 23:05:45 2022 UTC