Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 18696 - mail() function not defined in dev-php/mod_php-4.3.1 ebuild
Summary: mail() function not defined in dev-php/mod_php-4.3.1 ebuild
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Development (show other bugs)
Hardware: x86 Linux
: High blocker
Assignee: PHP Bugs
URL: http://quicksitemaker.com/test.php
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-04-03 11:38 UTC by Sean C. Burbidge
Modified: 2003-09-26 17:08 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sean C. Burbidge 2003-04-03 11:38:53 UTC
The mail() function, a core function of PHP 4, is not defined when executing a
script containing that function.  From the PHP web site concerning the mail()
function:

XLIX. Mail functions
Introduction

The mail() function allows you to send mail.
Requirements

No external libraries are needed to build this extension.
Installation

There is no installation needed to use these functions; they are part of the PHP
core.

There should be no dependency requirement to get this function working, and all
current dependencies were satisfied when I installed the package with portage.

Reproducible: Always
Steps to Reproduce:
1.  emerge mod_php, apache - configure apache to use php
2.  create a script using the mail() function.
3.  execute script through Apache

Actual Results:  
See http:/quicksitemaker.com/test.php

Expected Results:  
Sent mail as expected using settings from php.ini.

Relevant php.ini lines:

$ grep mail php.ini

[mail function]
sendmail_from = me@localhost.com
; For Unix only.  You may supply arguments as well (default: "sendmail -t -i").
sendmail_path = /var/qmail/bin/sendmail
Comment 1 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2003-04-06 20:09:00 UTC
Sean:
could you please give me a link to a phpinfo page on that server?
additionally
if you could include this snippet below the phpinfo(); call, it would help as well:
print_r(get_loaded_extensions());
Comment 2 Sean C. Burbidge 2003-04-08 14:41:37 UTC
http://quicksitemaker.com/phpinfo.php
Comment 3 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2003-04-08 16:49:16 UTC
Could you please comment out the "sendmail_path" line, then stop and start apache, and see if that resolves it ?
Comment 4 Sean C. Burbidge 2003-04-08 18:17:21 UTC
No, I still get the same error message after commenting out the sendmail_path line and restarting Apache.
Comment 5 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2003-04-08 18:23:44 UTC
hmm
try this for sendmail_path now:
/usr/sbin/sendmail -t -i

i'm fairly certain that is the problem with this.
Comment 6 Sean C. Burbidge 2003-04-08 19:30:59 UTC
No joy.  Still the same error.
Comment 7 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2003-04-08 22:08:33 UTC
*hits head against keyboard*
doh!

reading the PHP manual now, I saw this note:
"This problem/fix should be here since it oddly takes a long time to find the answer on the internet, yet the problem seems common. If you get 
mail() not supported in this PHP build
when trying to use this function then you need to recompile. This happens during configure if /sbin/sendmail is not found. For some reason PHP decides to leave out mail support entirely if it can't find this file while configuring for build. If you run qmail or some other sendmail replacement it is very likely this could be your situation. To fix, make sure the appropriate file or symlink exists. To be safe, why not make a symlink from /usr/sbin/sendmail too. In the case of qmail, these should both point to /var/qmail/bin/sendmail which is qmail's sendmail wrapper. 
After fixing that, delete config.cache and start your build over again and reinstall. Thanks to Surojit Niyogi -- and Google, for caching the page on the www.bajaar.com where he posted this simple solution which was unfortunately broken at the time I was looking for an answer."

Looking at the qmail build, it DOES create that symlink. Yours got lost somehow. Either recreate the symlink yourself, or just remerge qmail.
then remerge PHP.

I'm going to see about adding a check to the PHP/mod_php ebuild to enforce this.
Comment 8 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2003-04-08 22:11:23 UTC
whoops, messed up the URL
Comment 9 Sean C. Burbidge 2003-04-09 12:42:57 UTC
That appears to have worked.  My qmail build is custom, so I didn't emerge qmail from 
the portage system, and that may very well be why the symlink didn't exist.  I made 
links to both /usr/sbin/sendmail and /sbin/sendmail just for kicks and re-emerged 
mod_php.  Thanks for your help. 
Comment 10 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2003-04-09 14:37:02 UTC
Ok great, I'm closing this once I add in a check for /usr/sbin/sendmail 

Just out of interest, what did you do different that gentoo's qmail didn't have ?
Comment 11 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2003-05-14 18:59:58 UTC
Fixed in new PHP eclass to be released very soon.
When it is, please test it ASAP.
Comment 12 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2003-09-26 17:08:40 UTC
closing old bugs.