我正在尝试制作联系表格并收到此一般错误:
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, cgiadmin@yourhostingaccount.com and inform them of the time the error occurred, and anything you might have done that may have caused the error.
More information about this error may be available in the server error log.
我无法弄清楚如何让它实际记录或回显错误。这是我的 php 文件:
<?php
ini_set('display_errors', true);
ini_set('log_errors', true);
error_reporting(E_ALL);
ini_set('error_log', 'php.log');
$field_fname = $_GET['fname'] ;
$field_lname = $_GET['lname'] ;
$field_bname = $_GET['bname'] ;
$field_email = $_GET['email'] ;
$field_address = $_GET['address'] ;
$field_city = $_GET['city'] ;
$field_state = $_GET['state'] ;
$field_zip = $_GET['zip'] ;
$field_country = $_GET['country'] ;
$field_comments = $_GET['comments'] ;
$mail_to = 'myemail@mydomain.com';
$subject = 'Message from a site visitor '.$field_fname .$field_lname;
$body_message = 'From: '.$field_fname .$field_lname 'at' .$field_bname "\n";
$body_message = 'E-mail: '.$field_email "\n";
$body_message = 'Address:'.$field_address "\n";
$body_message = 'City:'.$field_city "\n";
$body_message = 'State:'.$field_state "\n";
$body_message = 'Zip Code:'.$field_zip "\n";
$body_message = 'Country:'.$field_country "\n";
$body_message = 'Message: '.$field_comments;
$headers = 'From: '.$field_email."\r\n";
$headers .= 'Reply-To: '.$field_email."\r\n";
$mail_status = mail($mail_to, $subject, $body_message, $headers);
if ($mail_status) { ?>
<script language="javascript" type="text/javascript">
alert('Thank you for the message. We will contact you shortly.');
window.location = 'index.html';
</script>
<?php
}
else { ?>
<script language="javascript" type="text/javascript">
alert('Message failed. Please, send an email to myemail@mydomain.com');
window.location = 'index.html';
</script>
<?php
}
?>
我不确定我在做什么是错的。如果有人可以帮助我找到错误或指导我记录或回显错误,我将不胜感激。
谢谢