Allow PHP to send mail in Fedora

Just run into this one as I’ve been configuring a new server.

On a fairly standard Fedora set-up it’s likely that the reason you can’t send emails from a PHP script is in fact because SELinux is stopping  Apache (httpd). This applies to both sending with Sendmail, and sending via SMTP.

You’ll need to run the following commands as root to fix the problem:

$ setsebool -P httpd_can_sendmail 1
$ /etc/init.d/httpd restart

One Response to Allow PHP to send mail in Fedora

  1. Arjumand says:

    I get the following error on running the command

    libsemanage.semanage_get_lock: Could not get direct transaction lock at /etc/selinux/targeted/modules/semanage.trans.LOCK. (Resource temporarily unavailable).
    Could not change policy booleans

Leave a Reply

Your email address will not be published. Required fields are marked *