發郵件的困難:php
2015/3/12 18:15html
[root@bogon html]# chown smmsp:smmsp /var/spool/clientmqueueapache
[root@bogon html]# chmod 2770 /var/spool/clientmqueue框架
[root@bogon html]# chgrp smmsp /usr/sbin/sendmailide
[root@bogon html]# chmod g+s /usr/sbin/sendmailpost
[root@bogon html]# /usr/sbin/usermod -G smmsp -g apache apacheui
2015/3/6 18:50this
使用CI自帶的發郵件,遇錯誤:Unable to send email using PHP mail(). Your server might not be configured to send mail using this method.rest
sudo yum install postfix , 裝好後仍然同樣,server
發現log中: Program mode requires special privileges, e.g., root or TrustedUser.
chmod -R 777 ugc_ci_framework 也不work;
/etc/php.ini 改爲sendmail.postfix , /etc/init.d/httpd restart 重啓了apache php配置生效,log報錯換成:sendmail.postfix: fatal: unable to use my own hostname
在框架外面直接用php的mail(),也是apache報錯:Program mode requires special privileges, e.g., root or TrustedUser.
與此同時,發現maillog也在報錯:
tail -f /var/log/maillog : NOQUEUE: SYSERR(apache): can not chdir(/var/spool/clientmqueue/): Permission denied
sudo chown smmsp:smmsp /var/spool/clientmqueue
sudo /usr/sbin/usermod -G smmsp -g apache apache
重啓apache,也仍是不行。。
maillog報錯改變:
NOQUEUE: SYSERR(apache): can not write to queue directory /var/spool/clientmqueue/ (RunAsGid=48, required=51): Permission denied
而且/var/log/httpd/error_log已經不報錯
chmod 777 clientmqueue 郵件就能發送了
此時把clientmqueue換回770,再執行: chmod g+s /usr/sbin/sendmail
就ok了。