【问题标题】:PHP that processes HTML form returns 503 error处理 HTML 表单的 PHP 返回 503 错误
【发布时间】:2015-06-29 14:33:15
【问题描述】:

在我的网站上,我使用表单让用户直接通过网站发送查询。为此,我使用此 PHP 代码进行处理,命名为“sendform.php”:

<?php
    $body = 'Online-Anfrage';
    $body .= '\r\n NAME:';
    $body .= $_POST["input_name"];
    $body .= '\r\n EMAIL:';
    $body .= $_POST["input_email"];
    $body .= '\r\n TELEFON:';
    $body .= $_POST["input_telefon"];
    $body .= '\r\n FAHRZEUG:';
    $body .= $_POST["input_fahrzeug"];
    $body .= '\r\n ERSTZULASSUNG:';
    $body .= $_POST["input_erstzulassung"];
    $body .= '\r\n KILOMETERSTAND:';
    $body .= $_POST["input_kilometerstand"];
    $body .= '\r\n PREISVORSTELLUNG:';
    $body .= $_POST["input_preisvorstellung"];

    $to = "my@mail.de";
    $headers = 'From: info@mmymail.de' . "\r\n" .
    'Reply-To: ' . $_POST["input_email"] . "\r\n" .
    'X-Mailer: PHP/' . phpversion();
    $subject = "Online-Anfrage";
    if (mail($to, $subject, $body, $headers)) 
    {
        echo("<p>Wir haben Ihre Anfrage erhalten. Vielen Dank für Ihr vertrauen!    </p>");  
    } 
    else 
    {
        echo("<p>Interner Serverfehler. Bitte rufen Sie uns für eine Anfrage direkt an:</p>");
    }
?>

但是当我尝试将 action="sendform.php" 与 index.html 一起使用时,我收到服务器错误 503。我使用的表单代码是这个:

                <form class="form-horizontal" method="post" action="sendform.php">
                    <fieldset>

                    <!-- Form Name -->
                    <legend>Kostenlose und unverbindliche Verkaufsanfrage</legend>

                    <!-- Text input-->
                    <div class="form-group">
                      <label class="col-md-4 control-label" for="input_name">Name</label>  
                      <div class="col-md-6">
                      <input id="input_name" name="input_name" type="text" placeholder="" class="form-control input-md" required="">

                      </div>
                    </div>

                    <!-- Text input-->
                    <div class="form-group">
                      <label class="col-md-4 control-label" for="input_email">E-Mail Adresse</label>  
                      <div class="col-md-6">
                      <input id="input_email" name="input_email" type="text" placeholder="" class="form-control input-md" required="">

                      </div>
                    </div>

                    <!-- Text input-->
                    <div class="form-group">
                      <label class="col-md-4 control-label" for="input_telefon">Telefonnummer</label>  
                      <div class="col-md-6">
                      <input id="input_telefon" name="input_telefon" type="text" placeholder="" class="form-control input-md" required="">

                      </div>
                    </div>

                    <!-- Text input-->
                    <div class="form-group">
                      <label class="col-md-4 control-label" for="input_fahrzeug">Fahrzeugmodell</label>  
                      <div class="col-md-6">
                      <input id="input_fahrzeug" name="input_fahrzeug" type="text" placeholder="" class="form-control input-md" required="">

                      </div>
                    </div>

                    <!-- Text input-->
                    <div class="form-group">
                      <label class="col-md-4 control-label" for="input_erstzulassung">Erstzulassung</label>  
                      <div class="col-md-6">
                      <input id="input_erstzulassung" name="input_erstzulassung" type="text" placeholder="" class="form-control input-md" required="">
                      <span class="help-block">Bitte Monat und Jahr angeben.</span>  
                      </div>
                    </div>

                    <!-- Appended Input-->
                    <div class="form-group">
                      <label class="col-md-4 control-label" for="input_kilometerstand">Kilometerstand</label>
                      <div class="col-md-6">
                        <div class="input-group">
                          <input id="input_kilometerstand" name="input_kilometerstand" class="form-control" placeholder="" type="text" required="">
                          <span class="input-group-addon">km</span>
                        </div>

                      </div>
                    </div>
                    <!-- Appended Input-->
                    <div class="form-group">
                      <label class="col-md-4 control-label" for="input_preisvorstellung">Preisvorstellung</label>
                      <div class="col-md-6">
                        <div class="input-group">
                          <input id="input_preisvorstellung" name="input_preisvorstellung" class="form-control" placeholder="" type="text" required="">
                          <span class="input-group-addon">€</span>
                        </div>

                      </div>
                    </div>
                    <button type="submit" class="btn btn-success col-md-12">Anfrage absenden!</button>

                    </fieldset>
                    </form>

我完全不知道如何解决这个问题,因为我在命名中找不到任何错误,所以肯定是有其他原因导致了这个错误。

服务器日志没有说“解析错误”之类的东西,当变量有问题时你会得到什么..

编辑:我确实收到了电子邮件,但它们只填充了静态文本,我收到的邮件中不存在变量

你能帮我解决这个问题吗?谢谢!

【问题讨论】:

  • 能否提供任何 Apache 错误日志信息?
  • 由于网站在共享的虚拟主机上运行,​​我无法访问日志文件:-/ 我只能访问错误日志,这些都是空的..
  • 您之前是否使用此主机成功发送过 PHP 电子邮件?
  • 是的,实际上编辑了我的帖子:编辑:我确实收到了电子邮件,但它们只填充了静态文本,我收到的邮件中不存在变量

标签: php html forms apache


【解决方案1】:

Web 服务器(运行网站)当前无法处理 HTTP 请求,原因是服务器临时过载或维护。这意味着这是一种暂时的情况,经过一段时间的延迟会得到缓解。某些处于这种状态的服务器也可能会简单地拒绝套接字连接,在这种情况下,可能会因为套接字创建超时而产生不同的错误。

click here for details and how to remove

and also this

【讨论】:

  • 好吧,我实际上知道错误 503 的含义,但我的服务器给出了错误但也在处理 php(我确实收到了邮件,但变量丢失了)
  • 首先通过在 sendform.php 文件的开头添加这些行来打印帖子信息。即 ";print_r($_POST);... 然后找到什么错误。
猜你喜欢
  • 2011-07-08
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2012-06-16
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多