Search This Blog

Tuesday, February 23, 2010

PHP mail returns false on Fedora linux

While helping out a friend on a PHP installation, came across this issue.

Everything worked fine on his development server. But on his deployment server, the mail function returned false and hence no mails were sent out.

After some debugging found that the issue was with permission for httpd on sendmail.

vim /var/log/maillog had error NOQUEUE: SYSERR(apache): /etc/mail/sendmail.cf: line 0: cannot open: Permission denied

After spending some time on Google, came across this command.
# getsebool -a | grep sendmail
httpd_can_sendmail --> off

So the issue was that the apache user did not have permissions to send mails using sendmail.

Ran the following command
# togglebool httpd_can_sendmail

and everything worked fine.

No comments: