发送邮件报错误:PEAR mail package is not installed的原因是linux中缺少PEAR mail组件,
PEAR mail组件也就是PHP Pear Mail / SMTP软件包的三大支持:
1)NET / SMTP:SMTP协议的实现
2)邮件:提供发送邮件的多个接口的类
3)网络/ Socke:网络接口
解决方法:在php pear repo中下载并安装
1.下载文件
[root@tele- ~]# cd /tmp
[root@tele- tmp]# wget http://download.pear.php.net/package/Mail-1.1.14.tgz
[root@tele- tmp]# wget http://download.pear.php.net/package/Net_SMTP-1.2.10.tgz
[root@tele- tmp]# wget http://download.pear.php.net/package/Net_Socket-1.0.8.tgz
2.解压文件
[root@tele- tmp]# tar -zxvf Mail-1.1..tgz
[root@tele- tmp]# tar -zxvf Net_SMTP-1.2..tgz
[root@tele- tmp]# tar -zxvf Net_Socket-1.0..tgz
3.安装文件
[root@tele- tmp]# cd /usr/share/pear
[root@tele- pear]# mkdir Net
[root@tele- pear]# cd Net
[root@tele- Net]# cp /tmp/Net_SMTP-1.2./SMTP.php .
[root@tele- Net]# cp /tmp/Net_Socket-1.0./Socket.php .
[root@tele- Net]# cd ..
[root@tele- pear]# cp -avr /tmp/Mail-1.1./Mail/ .
‘/tmp/Mail-1.1./Mail/’ -> ‘./Mail’
‘/tmp/Mail-1.1./Mail/null.php’ -> ‘./Mail/null.php’
‘/tmp/Mail-1.1./Mail/mail.php’ -> ‘./Mail/mail.php’
‘/tmp/Mail-1.1./Mail/smtp.php’ -> ‘./Mail/smtp.php’
‘/tmp/Mail-1.1./Mail/sendmail.php’ -> ‘./Mail/sendmail.php’
‘/tmp/Mail-1.1./Mail/RFC822.php’ -> ‘./Mail/RFC822.php’
[root@tele- pear]# cp -avr /tmp/Mail-1.1./Mail.php .
‘/tmp/Mail-1.1./Mail.php’ -> ‘./Mail.php’
然后再项目中重新测试即可
帮助链接:https://www.cyberciti.biz/tips/rhel-install-php-net-smtp-email-socket.html