天天看點

解決PHP郵件一直不能發送的問題

apache的日志提示

email send error: Could not instantiate mail function

mail日志提示:

NOQUEUE: SYSERR(apache): /etc/mail/sendmail.cf: line 0: cannot open: Permission denied
           

google發現是SElinux的安全機制導緻

evealed that the issue was caused by SELinux.

Running: getsebool httpd_can_sendmail returns off, which means that Apache (httpd) doesn’t have permission to send emails.

The issue was resolved by running:

setsebool -P httpd_can_sendmail on