【发布时间】:2015-04-25 17:09:14
【问题描述】:
[Sat Apr 25 04:18:46.660552 2015] [fastcgi:error] [pid 11271:tid 140464355243776] [client 95.87.236.146:63037] FastCGI: comm with server "/usr/lib/cgi-bin/php5-fcgi-domain.cc" aborted: idle timeout (30 sec), referer: http://domain.cc/login/restore_session.php?redirect=yes
[Sat Apr 25 04:18:46.660673 2015] [fastcgi:error] [pid 11271:tid 140464355243776] [client 95.87.236.146:63037] FastCGI: incomplete headers (0 bytes) received from server "/usr/lib/cgi-bin/php5-fcgi-domain.cc", referer: http://domain.cc/login/restore_session.php?redirect=yes
我的 error.log 文件中出现了这些错误。当我尝试使用 mail() 函数发送电子邮件时会发生这种情况:
$to = $ticket->email;
$subject = "X Support";
$message = "We have just answered your support ticket! Here is our message: \n\n-------------\n\n" . $text . "\n\n-------------\n\nIf you wish to reply, please visit http://domain.cc/support.php";
$headers = "From: noreply@domain.cc\r\n" .
"Reply-To: noreply@domain.cc\r\n" .
"X-Mailer: PHP/" . phpversion() . "\r\n";
$headers .= "CC: noreply@domain.cc\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
$result = mail($to, $subject, $message, $headers);
我使用 AJAX 调用此代码,结果当我单击“发送回复”时,页面只是挂起,30 秒后我收到 500 错误作为响应。奇怪的是,这段代码过去几个月都可以正常工作。
编辑:我忘了提 - 电子邮件还是会送达。
【问题讨论】:
-
您在
phpversion()之后缺少\r\n。但我认为这不会导致错误,它只是不会执行 CC。 -
就像我说的,我没想到会解决它。
-
请注意,日志消息不是指邮件头,而是指应该从 PHP 发送到 Apache 的 HTTP 头。
-
我怀疑您服务器上的邮件配置有问题。