Php ajaxForm 500内部服务器错误

Php ajaxForm 500内部服务器错误,php,ajax,symfony1,Php,Ajax,Symfony1,嗨,我正在用注释制作一个ajaxForm。我的问题是为什么错误是500内部服务器错误???,我的代码和js库都在里面,我不太明白为什么500内部服务器错误。。下面是我的代码 <script> $(document).ready(function(){ $("#tbl_comments").hide(); //$("#loading").hide(); $("#ptxt_green").hide(); $('#comment_form').ajax

嗨,我正在用注释制作一个ajaxForm。我的问题是为什么错误是500内部服务器错误???,我的代码和js库都在里面,我不太明白为什么500内部服务器错误。。下面是我的代码

<script>
  $(document).ready(function(){
    $("#tbl_comments").hide();
    //$("#loading").hide();
    $("#ptxt_green").hide();

    $('#comment_form').ajaxForm({  
      target: '.result',
      beforeSubmit: validate,
      success: function(data) {
        alert(data);
      }
    });

    $("#loading")
      .hide()
      $(".result").show()
      .ajaxStart(function(){
        $(this).show();
        $(".result").hide();
        $("#loading").show();
      })
      .ajaxStop(function(){
        $(this).hide();
        $(".result").show();
      })
    ;


  });
  function validate(){
    var comment = $('textarea[name=txt_comment]').fieldValue();
    if(!comment[0]){
      $("#ptxt_green").fadeIn();
      $("#ptxt_green").fadeOut(3000);

      return false;
    }
  }
</script>
<?php $sf_response->setTitle(myTitleFactory::getPageTitle('seminar_detail', 'frontend',array('%seminar_title%'=>$seminar->getTitle())));?>
<?php myTools::loadBreadSlot(array(
  myBreadcrumbFactory::get('seminar-list', 'frontend'),
  myBreadcrumbFactory::get('seminar', 'frontend', array('slug' => $seminar->getSlug()), $seminar->getTitle())))  
?>

    <h1><?php echo $seminar->getTitle(); ?></h1>

    <div class="table_seminar_wrap">
    <table class="table_seminar" cellspacing="0" cellpadding="0" border="0" summary="info table">
      <tr>
        <th>Employee Id</th>
        <td><?php echo $seminar->getId(); ?></td>
      </tr>
      <tr>
        <th valign="top">情報公開日</th>
        <td><?php echo $seminar->getPublishDate() .' '.$seminar->getPublishHour(); ?>時</td>
      </tr>
      <tr>
        <th valign="top">セミナースキーム</th>
        <td><?php echo $seminar->getStyle(); ?></td>
      </tr>
      <tr>
        <th valign="top">日程</th>
        <td><?php echo $seminar->getSeminarDate() .' '.$seminar->getStartTime() .' ~'.$seminar->getEndTime(); ?></td>
      </tr>
      <tr>
        <th valign="top">前振りの文章</th>
        <td><?php echo $seminar->getRawValue()->getSummary(); ?></td>
      </tr>
      <tr>
        <th valign="top">タイトル</th>
        <td><?php echo $seminar->getTitle(); ?></td>
      </tr>
      <tr>
        <th valign="top">サブタイトル</th>
        <td><?php echo $seminar->getSubTitle(); ?></td>
      </tr>
      <tr>
        <th valign="top">開催地</th>
        <td><?php echo $seminar->_getAddress(ESC_RAW); ?></td>
      </tr>
      <tr>
        <th valign="top">会場</th>
        <td>
          <?php if($seminar->getLocationName()) : ?>
            <?php echo $seminar->getLocationName(); ?><br>
          <?php endif; ?>
          <?php if($seminar->getRoomName()) : ?>
            <?php echo $seminar->getRoomName(); ?>
          <?php endif; ?>
        </td>
      </tr>
      <?php if($seminar->getLocationName()) : ?>
      <tr>
        <th valign="top">会場URL</th>
        <td><a href="<?php echo $seminar->getLocationUrl(); ?>" target="_blank" rel="nofollow"><?php echo $seminar->getLocationUrl(); ?></a></td>
      </tr>
      <?php endif; ?>
      <tr>
        <th valign="top">内容</th>
        <td><?php echo $seminar->getRawValue()->getDetail(); ?></td>
      </tr>
      <tr>
        <th valign="top">キーチャート</th>
        <td>
          <?php if($seminar->getImagePath()): ?>
            <a href="<?php echo $seminar->getImagePath(); ?>" target="_blank">
              <img style="width:300px;" src="<?php echo $seminar->getImagePath(); ?>"/></a>
          <?php endif; ?>
        </td>
      </tr>
      <tr>
        <th valign="top">対象</th>
        <td>
          <?php foreach($seminar->getTarget() as $target): ?>
            <?php echo $target; ?>
          <?php endforeach;?>
        </td>
      </tr>
      <tr>
        <th valign="top">定員・残席状況</th>
        <td><?php echo $seminar->getCapacity(); ?>人</td>
      </tr>
      <tr>
        <th valign="top">参加料</th>
        <td><?php echo $seminar->getPrice(); ?></td>
      </tr>
      <tr>
        <th valign="top">担当者</th>
        <td><?php echo $seminar->getEmployee()->getName(); ?></td>
      </tr>
      <tr>
        <th valign="top">講師</th>
        <td>
          <img class="instructorImage" alt="Instructor Image" src="<?php echo $seminar->getInstructor()->_getImagePath(); ?>" /><br>
          <span><?php echo $seminar->getInstructor()->getName(); ?><span>
        </td>
      </tr>
      <tr>
        <th valign="top" style="width:170px">ご参加の皆様へのメッセージ</th>
        <td><?php echo $seminar->getRawValue()->getMessage(); ?></td>
      </tr>
      <?php if($sf_user->isAuthenticated() && !$seminarXPerson): ?>
        <tr>
          <td style="text-align:center;" colspan="2">
            <div class="blueBtnLink">
              <a href="<?php echo url_for('seminar/apply?id='.$seminar->getId()); ?>" title="応募する"><span>応募する</span></a>
           </div>
          </td>
        </tr>
      <?php elseif(!$sf_user->isAuthenticated()): ?>
      <tr>
        <td style="text-align:center;" colspan="2">
          <div class="blueBtnLink">
            <a href="<?php echo url_for('seminar/apply?id='.$seminar->getId()); ?>" title="応募する"><span>応募する</span></a>
         </div>
        </td>
      </tr>
      <?php endif; ?>
    </table>
    <div id="ptxt_green">
      <p>Please Write A Comments. . .</p>
    </div>
    <br />
    <?php if($sf_user->isAuthenticated()): ?>
    <form id="comment_form" action="<?php echo url_for('seminar/comment');?>" method="post">
      <textarea id="txt_comment" name="txt_comment"></textarea>
      <input type="submit" value="Write Comments" />
      <br />
      <br />
      <div id="loading" style="text-align:center;">
        <img alt="" src="/images/loading.gif" />
      </div>
      <div class="result">
        <table id="tbl_comments">
          <tr>
            <td width="10%">Comments:</td>
            <td>asasa</td>
          </tr>     
        </table>
      </div>
    </form>
    <?php endif; ?>
</div>

$(文档).ready(函数(){
$(“#待定注释”).hide();
//$(“#加载”).hide();
$(“#ptxt_green”).hide();
$('#注释形式')。ajaxForm({
目标:'.result',
提交前:验证,
成功:功能(数据){
警报(数据);
}
});
$(“#加载”)
.hide()
$(“.result”).show()
.ajaxStart(函数(){
$(this.show();
$(“.result”).hide();
$(“#加载”).show();
})
.ajaxStop(函数(){
$(this.hide();
$(“.result”).show();
})
;
});
函数验证(){
var comment=$('textarea[name=txt_comment]')。fieldValue();
如果(!注释[0]){
$(“绿色”).fadeIn();
$(“绿色”)。淡出(3000);
返回false;
}
}
员工Id
情報公開日
時
セミナースキーム
日程
前振りの文章
タイトル
サブタイトル
開催地
会場

会場统一资源定位地址 内容 キーチャート 対象 定員・残席状況 人 参加料 担当者 講師 Get讲师()->_getImagePath();?>“/>
ご参加の皆様へのメッセージ 请写一篇评论



您没有提供足够的信息让任何人给您一个明确的答案,但以下是一些疑难解答提示:

检查您的服务器日志。要找到日志所在的位置,请查看并尝试
grep
查看日志,以下是一些可以尝试的日志(直接从参考的ServerFault问题中窃取)

  • grep ErrorLog/usr/local/etc/apache22/httpd.conf
  • grep ErrorLog/etc/apache2/apache2.conf
  • grep ErrorLog/etc/httpd/conf/httpd.conf
找到服务器日志后,请找到与500错误对应的日志项。如果很难找到它,请向客户端发出另一个请求,然后尝试查找最新的日志项

JavaScript中可能的错误源包括:

  • 调用错误的URL
  • 调用正确的URL但参数错误
  • 调用正确的URL和参数,但格式错误(即JSON与XML)
  • 调用正确的URL、参数和格式,但使用错误的方法(即GET vs POST)
  • 调用正确的URL/参数/格式/方法,但发送web服务器拒绝的虚假数据(即某些服务器配置为自动拒绝某些看起来恶意的字符串)
顺便说一句您发布的服务器端代码并不能说明全部情况。它是一个简单的类,但位于一个复杂的框架之上,您需要检查框架配置,看看是否一切正常。特别是,尝试直接调用操作(即在web浏览器中,而不是通过jQuery/JS)。如果它不起作用,请尝试调用其他操作,看看它是否起作用。如果您无法使任何操作起作用,则可能是框架配置问题。我不熟悉symfony,但如果我被迫这样做,我将从那里开始


如果您能向我们提供错误日志,这将非常有帮助。

尝试从ajaxCall调用dev controller。 通常您调用
index.php
,它是生产控制器,不提供有关错误的任何有用信息。请尝试调用
front\u dev.php
,它将返回有关错误的其他信息。
(开发控制器的名称通常是您的应用程序名称,后缀为
\u dev.php
,因此
front\u dev.php
假定您的应用程序名称为front,这是默认的btw)

500服务器错误是服务器上的错误,这并不奇怪。有关详细信息,请查看服务器错误日志。哪里可以找到?服务器上的错误?本地主机xampp apacheLook中的im
/etc/httpd/logs
。完整路径是什么?1)我不知道系统上的完整路径。2)您的代码可能有很多问题-错误路径为我将在哪里发布我的错误日志在这里不能发布超过1000个字符
<?php
class commentAction extends sfAction{

    public function execute($request){
      echo "test"; exit();
      //echo "qwqqwqqw"; exit();
      //$post = $request->getParameter('seminar');
      ////print_r($post);exit();
      //$comment = new SeminarComments();
      //$comment->setComments($post['txt_comment']);
      //$comment->save();
      //$this->redirect('seminar');

    }
  }
?>