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
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());
http://quicksitemaker.com/phpinfo.php
Could you please comment out the "sendmail_path" line, then stop and start apache, and see if that resolves it ?
No, I still get the same error message after commenting out the sendmail_path line and restarting Apache.
hmm try this for sendmail_path now: /usr/sbin/sendmail -t -i i'm fairly certain that is the problem with this.
No joy. Still the same error.
*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.
whoops, messed up the URL
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.
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 ?
Fixed in new PHP eclass to be released very soon. When it is, please test it ASAP.
closing old bugs.