【发布时间】:2015-10-31 07:21:02
【问题描述】:
我很困惑为什么这个联系表单会返回 500 内部服务器错误。我 99% 确信我的代码完美无瑕。
我使用 Parallels Plesk Panel 9.5 作为我的主机管理控制面板。我找到了日志管理器,并检查了访问日志和错误日志。在错误日志中有 [error] [client 162.247.90.74]、[error] [client 184.164.146.26] 表示文件不存在和 [error] [client 216.21.233.2] 表示无法创建或生成的条目子进程。
contact.html 上我的 HTML 表单:
<form class="form-horizontal" method="post" action="mailer.php" class="form-horizontal" role="form">
<div class="form-group">
<label for="name" class="col-sm-2"><small>Name</small></label>
<div class="col-sm-10">
<input type="text" class="form-control" id="inputName" name="inputName" placeholder="Enter your full name" required>
</div>
</div>
<div class="form-group">
<label for="email" class="col-sm-2"><small>Email</small></label>
<div class="col-sm-10">
<input type="email" class="form-control" id="inputEmail" name="inputEmail" placeholder="Enter your email, example@domain.com" required>
</div>
</div>
<div class="form-group">
<label for="name" class="col-sm-2"><small>Telephone</small></label>
<div class="col-sm-10">
<input type="text" class="form-control" id="inputPhone" name="inputPhone" placeholder="Enter your telephone number" required>
</div>
</div>
<div class="form-group">
<label for="message" class="col-sm-2"><small>Message</small></label>
<div class="col-sm-10">
<textarea class="form-control" rows="4" name="inputMessage" id="inputMessage" placeholder="Enter your message here" required></textarea>
</div>
</div>
<div class="form-group">
<p class="antispam">Leave this empty:
<br /><input name="url" /></p>
</div>
<div class="form-group">
<div class="col-sm-10 col-sm-offset-2">
<input style="font-size:22px;" id="submit" name="submit" type="submit" value="Send" class="btn">
</div>
</div>
</form>
mailer.php 文件:
<?php
// if the url field is empty
if(isset($_POST['url']) && $_POST['url'] == ''){
// then send the form to your email
mail( 'info@website.com', 'Contact Form', print_r($_POST,true) );
}
// otherwise, let the spammer think that they got their message through
// redirect to thank you page
header('Location: http://www.website.com/thankyou.html');
exit('Redirecting you to http://www.website.com/thankyou.html');
?>
【问题讨论】:
-
我 99% 确定您的主机并非完美无缺且配置错误。
-
是否有可能从我提供的信息中看出我需要向我的主人做些什么来解决这个问题?
-
很遗憾没有,这是您需要联系您的托管支持提供商的问题
-
为什么你的
<label for="标签与你的输入ID不同? -
@mituw16 我打电话给我的托管支持提供商,他们说他们无法帮助我使用自定义代码(他们指的是我的 mailer.php 文档)。我告诉他们这是他们的问题。他们说不是。他们在嘲笑我吗?
标签: php contact-form plesk