お問い合わせフォームを作成しようとしていますが、次の一般的なエラーが発生しています。
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
}
?>
私がしていることが間違っているかどうかはわかりません。誰かがエラーを見つけるのを手伝ってくれるか、エラーをログに記録またはエコーするように指示してくれれば、本当に感謝しています。
ありがとう