在php發(fā)函數時,函數mail()提示Could not instantiate mail function.錯誤,用phpmailer組件發(fā)送也提示這個錯誤,現在我把解決問題整理出來.
網上有很多朋友用phpmailer組件發(fā)送郵件提示: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! //Vevb.com
- /etc/init.d/php-fpm restart
新聞熱點
疑難解答