I cannt send mail from php script although I can send it from command line with sendmail and
php sendMyMail.php
I have already tried these
httpd is running as apache user and I added apache user to smmsp group
httpd_can_sendmail --> on
SELinux status: enabled SELinuxfs mount: /selinux Current mode: permissive Mode from config file: enforcing Policy version: 24 Policy from config file: targeted
But in httpd error_log still showing this error
sh: /usr/sbin/sendmail: Permission denied
Can anyone have any idea? I do really appreciate all your suggestions and really exhausted with this one.
除了setsebool -P httpd_can_sendmail 1
你还需要允许apache连接外: setsebool -P httpd_can_network_connect 1
That you can send emails from the command line does not mean that any user can (apache for instance).
Check that apache can actually send emails:
sudo -u apache sendmail root@localhost
Read the mail logfile (usually /var/log/mail.log) to see what happened. Inbox of root is usually in /var/spool/mail/root ). Tipp: Use other user different from root if you don't want to use root as a guinea pig.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.