首页 > 语言 > PHP > 正文

php函数mail()报Could not instantiate mail function.错误解决

2024-09-04 11:49:16
字体:
来源:转载
供稿:网友

在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绝对路径:

  1. vim /usr/local/php/etc/php.ini 
  2. sendmail_path = /usr/sbin/sendmail -t -i 
  3. :wq! //Vevb.com 
  4. /etc/init.d/php-fpm restart

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表