php函数mail()报Could not instantiate mail function.错误解决
在php发函数时,函数mail()提示Could not instantiate mail function.错误,用phpmailer组件发送也提示这个错误,现在我把解决问题整理出来.
网上有很多朋友用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! //phpfensi.com
- /etc/init.d/php-fpm restart