[英]IIS PHP Contact Form - Failed to load resource: the server responded with a status of 500 (Internal Server Error
I have a template I downloaded and with it came a PHP form. 我有一个我下载的模板,随之来了一个PHP表格。 When submitting the form the console shows: Failed to load resource: the server responded with a status of 500 (Internal Server Error)
提交表单时,控制台显示:无法加载资源:服务器响应状态为500(内部服务器错误)
HTML: HTML:
<form action="contact-form.php" method="POST" class="contact-form">
<ul class="row">
<li class="col-md-6 form-item">
<label for="contact-name"><i class="ico-male"></i></label>
<input type="text" name="contact-name" class="contact-name" id="contact-name" value="Your Name" onblur="if(this.value=='')this.value='Your Name'" onfocus="if(this.value=='Your Name')this.value=''">
</li>
<li class="col-md-6 form-item">
<label for="contact-email"><i class="ico-email"></i></label>
<input type="email" name="contact-email" class="contact-email" id="contact-email" value="Your Email" onblur="if(this.value=='')this.value='Your Email'" onfocus="if(this.value=='Your Email')this.value=''">
</li>
<li class="col-md-12 form-item">
<label for="contact-message"><i class="ico-bubble"></i></label>
<textarea name="contact-message" class="contact-message" id="contact-message" data-placeholder="Your message"></textarea>
</li>
<li class="col-md-12 form-item">
<input type="submit" name="contact-btn" class="contact-btn general-link" id="contact-btn" value="Send Your Message">
</li>
</ul>
</form><!-- end of contact form -->
PHP: PHP:
<?php
if($_POST["submit"]) {
$fromEmail = strip_tags($_POST['contact-email']);
$fromName = strip_tags($_POST['contact-name']);
$themessage = strip_tags($_POST['contact-message']);
$themessage = $themessage."The Sender Is ( ".$fromName." )" ;
$toEmail = 'jh@gmail.com';
$toName = 'JH';
Mail::send('emails.contactus', $data , function($message) use ($toEmail, $toName, $fromEmail, $fromName, $subject)
{
$message->to($toEmail, $toName);
$message->from($fromEmail, $fromName);
$message->subject($subject);
});
$headers = 'From:' .$fromName . "\r\n" .
'Reply-To:' .$fromEmail. "\r\n" .
'X-Mailer: PHP/' . phpversion();
if(mail($toEmail, $subject, $themessage, $headers))
{
// Send
echo "success";
}
else{ echo "An error has be occured"; }
}
?>
I am doing this locally on IIS Server and receiving this. 我在IIS服务器上本地执行此操作并接收此信息。
Edit: 编辑:
It is showing the error HTTP Error 500.0 - Internal Server Error C:\\Program Files\\PHP\\v7.0\\php-cgi.exe - The FastCGI process exited unexpectedly 它显示错误HTTP错误500.0 - 内部服务器错误C:\\ Program Files \\ PHP \\ v7.0 \\ php-cgi.exe - FastCGI进程意外退出
I have gone through the fixes that are shown on other answers such as: 我已经完成了其他答案中显示的修复,例如:
The FastCGI process exited unexpectedly FastCGI进程意外退出
You might be using C:/[your-php-directory]/php.exe in Handler mapping of IIS just change it C:/[your-php-directory]/php-cgi.exe.
您可能在IIS的Handler映射中使用C:/ [your-php-directory] /php.exe只需将其更改为C:/ [your-php-directory] /php-cgi.exe。
IIS 7.5 PHP failure "The FastCGI process exited unexpectedly" IIS 7.5 PHP失败“FastCGI进程意外退出”
To fix it I had to install the Visual C++ Redistributable for Visual Studio 2012 Update 3
为了解决这个问题,我必须为Visual Studio 2012 Update 3安装Visual C ++ Redistributable
It's still showing the same error. 它仍然显示相同的错误。 Not sure how to resolve this now.
现在不知道如何解决这个问题。
检查表单部分的编码。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.