Php不起作用,当我尝试重新安装时,我收到错误:
<?php
require('PHPMailer/class.phpmailer.php');
require('PHPMailer/class.smtp.php');
$headers = "Content-Type: text/html; charset=UTF-8";
$headers = 'From: '.$email_from."\r\n".
'Reply-To: '.$email_from."\r\n" .
'X-Mailer: PHP/' . phpversion();
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->CharSet="SET NAMES UTF8";
$mail->SMTPDebug = 0;
$mail->CharSet="utf8";
$mail->Debugoutput = 'html';
$mail->host = "smtp.gmail.com";
$mail->port = 465;
$mail->smtpauth = true;
$mail->smtpsecure = 'ssl';
$mail->username = "gmail-username"; //or domain credentials on google mail
$mail->password = "gmail-password";
$mail->SetFrom('from-email', 'from-name');
$mail->AddAddress('to-address', 'to-address');
$mail->Body = 'your-text'; //emailbody
if(!$mail->Send())
{
mysql_close();
echo "<script>alert('Error: " . $mail->ErrorInfo."');</script>";
}
else
{
mysql_close();
echo "<script>alert('success');</script>";
}
?>
并没有安装php。 如何更改东西以使两个版本都在同一版本,以便能够正确安装php?
答案 0 :(得分:1)
问题在于: yum删除mod_php71w php71w-cli
答案 1 :(得分:-1)
我刚刚为phpBB3安装了php。我遇到了同样的问题,我解决了。
请运行以下命令以删除计算机中的冲突部件:
yum remove mod_php71w-7.1.2-1.w7.x86_64
yum remove mod_php71w-7.1.2-1.w7.x86_64
然后安装所需的内容,例如:
yum install -y mod_php71w php71w-cli php71w-common php71w-gd php71w-mbstring php71w-mcrypt php71w-mysqlnd php71w-xml