View Full Version : PHP Mail Problem
July 13th, 2004, 04:55 PM
I have recently installed Photopost running on SuSe 9.1 with PHP and POSTFIX. When a user tries to register they get the following error....
Fatal error: Call to undefined function: mail() in /srv/www/htdocs/photopost/register.php on line 293
I have checked my php.ini file and it has the correct path to sendmail..
I have searched everywhere and emailed support but have not had any luck so far.
Thanks in advance,
July 13th, 2004, 05:10 PM
You need to set your path to the command php is going to use for sendmail
July 13th, 2004, 05:29 PM
I thought I was by the sendmail=/usr/sbin/sendmail command in the Php.ini file. If that is not the case what do I need to put there?
July 13th, 2004, 05:43 PM
Photopost simply uses the php mail function. You would need to contact your host to find out the mail path etc. If they do not have mail setup correctly for use with PHP there is not too much we can do.
July 13th, 2004, 05:45 PM
I am the host actually....That is the correct path and I am able to send and receive email, just not via php. I guess my question is there particular permissions needed on the /usr/sbin/sendmail file? What do people typically use for the command line in the php.ini file? Surely this isn't the first time someone has come across this.
July 13th, 2004, 11:27 PM
You have verified sendmail is where is and the path is correct in the php.ini
July 14th, 2004, 09:39 AM
yes, if you would like to see the error in action I will PM you the site.
July 14th, 2004, 11:27 AM
Many Many threads on the internet about this
So, we got this weird (and frustrating) error on our production server and I didn't find much help on Google at the time. We got to fix it, so now is the time to give back.
Executive summary: This error occurs because PHP couldn't find sendmail at compile time. So the mail function didn't get built, thank you. Here's what to do to fix it:
# If you compiled PHP before compiling (or installing) Sendmail, you just have to recompile PHP again (with Sendmail installed) and, hopefully, you're done.
# If you use QMail (that was our case), you have to fool PHP that Sendmail is actually there, using QMail's wrapper. Just do: ln -s /var/qmail/bin/sendmail /usr/sbin/sendmail , recompile and, hopefully, you're done.
# You're using some other esoteric mail server which is not Sendmail. If it has a wrapper to Sendmail, try the QMail tip (doing a symbolic link to the wrapper). If you don't have a wrapper, well... you're on your own. Unless you really need to use that mail server, I recommend QMail or Postfix.
In all cases you must recompile. It's important to do a make clean and then do the whole configure/make/make install dance, otherwise you'll compile the same configuration (with no mail function) all over again. Yes, I did that twice, silly me.
I don't know exactly in which places PHP looks for Sendmail, but I know one of them is /usr/sbin/ (to make it clear, it looks for the file /usr/sbin/sendmail).
Hope that helps.
July 14th, 2004, 11:30 AM
Also there is this
> I have defined it. Still no dice...that's why I'm posting.
Usually this happens with RedHat installations of PHP compiled manually
by a non-root user. What happens is that PHP configure does not find
sendmail program in the PATH and disables the mail function. The
solution is to rebuild PHP adding first to the PATH the directory where
the sendmail executable can be found, usually /usr/lib/sendmail but that
often that is a link to /usr/sbin/sendmail .
July 14th, 2004, 03:46 PM
Ok, I fixed it...I first uninstalled and reinstalled PHP using the YAST program but that still didn't fix my problem. I downloaded the latest PHP binary, compiled it, installed it and that seems to have fixed the problem. Not sure why it didn't work the first time because sendmail/postfix was installed before PHP was installed, none the less it is now working. Thanks for you help.
July 14th, 2004, 03:48 PM
vBulletin® v3.8.1, Copyright ©2000-2014, Jelsoft Enterprises Ltd.