网上有很多朋友用phpmailer组件发送邮件提示:Could not instantiate mail function.错误,解决方案少之用少,原因是服务器没有安装sendmail组件,使用yum进行安装:
yum install sendmail
/etc/init.d/sendmail start
注意:如果sendmail启动缓慢,请将hostname加入到/etc/hosts里面
配置/usr/local/php/etc/php.ini,填写sendmail绝对路径:
vim /usr/local/php/etc/php.ini
sendmail_path = /usr/sbin/sendmail -t -i
:wq!
/etc/init.d/php-fpm restart