A web server I manage is having problems sending mail from PHP. This server uses exim4 for MTA, and it is configured correctly.

I can send emails from PHP's CLI, but not from the web. i.e. if I do "php mailtest.php" on the command line, the email gets sent correctly, but if I browse to server.com/mailtest.php, mail() returns false and the email never gets sent. Nothing appears in the exim mainlog.

Any advice, or things I should look for ?

Thanks!

link|improve this question
What distro? Are you running in an SELinux-protected configuration? – jgoldschrafe Nov 8 '10 at 12:01
@jgoldschrafe Debian 5.0.6 and no. – jfoucher Nov 25 '10 at 19:09
feedback

2 Answers

It sounds like you've got different versions of php.ini located under /etc/php5/

debian:/etc/php5# find . | grep php.ini
./cli/php.ini
./apache2/php.ini

Check the [mail function] directive

link|improve this answer
I did, they're the same in both files. I actually copied one to the other (and the other way around) and got the exact same results – jfoucher Nov 25 '10 at 19:11
Do a phpinfo() and add the php server information "sendmail" to your question. Exim will normally replace the sendmail binary with the send compartible exim binary. – DrDol Dec 28 '10 at 22:39
feedback

This just solved my problem. I had php.ini in /cgi and /cli under that dir. I left the one in apache2 and renamed the others to php.ini_bk and phpsendmail worked straight away. (all the copies were the same as well)

Thanks, was looking for this for hours!

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.