【问题标题】:PHP/Joomla "Premature end of script headers: cgi_wrapper"PHP/Joomla“脚本头过早结束:cgi_wrapper”
【发布时间】:2012-12-16 20:36:41
【问题描述】:

我的网站出现 500 内部服务器错误。错误日志显示以下错误:“脚本头过早结束:cgi_wrapper”,在我的 Joomla 应用程序中。

它仅在加载一个特定文件时发生。应用程序/网站的其余部分正常工作。错误日志中没有显示其他相关问题 - 没有超时或权限错误的指示。

导致错误的文件是模板/布局文件。此外,我已经确定了一个会导致错误的代码 sn-p,当它被注释掉时,网站加载得很好。这里是:

    if( $question->type == '1' || $question->type == '2' || $question->type == '3' )
    {
        //shuffle items
        $shuffled_items = $this->shuffle_assoc($items);
        $output = '';
        $output .= '<table class="answer-table">';
        $output .= '<tr>';
        $output .= '<td>';
        $output .= '<ul class="answers">';

        foreach($shuffled_items as $item)
        {
            $output .= '<li num=' . $item->num . '>';
            $output .= $item->item;
            $output .= '</li>';
        }

        $output .= '</ul>';
        $output .= '</td>';
        $output .= '</tr>';
        $output .= '</table>';

        $output .= '<table class="answer-table correct-answer" style="display: none">';
        $output .= '<tr>';
        $output .= '<td>';
        $output .= '<p class="question-instructions">Correct Answer:</p>';
        $output .= '<ul class="answers correct-answer">';

        foreach($items as $item)
        {
            $output .= '<li num=' . $item->num . '>';
            $output .= $item->item;
            $output .= '</li>';
        }

        $output .= '</ul>';
        $output .= '</td>';
        $output .= '</table>';

        echo $output;
    }

它使用在 view.html.php 文件中设置的变量 $questions(对于那些了解 Joomla 的人)。似乎是这个变量触发了错误。如果我不分配 $questions 变量,那么模板将正常加载。

此外,在上面的示例中,它首先测试问题类型($question->type)。如果 $question->type 不是 1、2 或 3,还有其他代码部分会被触发,并且仍然会产生错误。但为了简洁起见,我省略了其他代码,因为它仅在存在相关问题类型。当上面的代码单独运行时,它会导致错误。

所以,我迷路了。让我感到困惑的是,只有这个模板文件和 $questions 变量会导致错误。其他一切正常。它在我的本地服务器上也运行良好。

差点忘了,使用的是 Joomla 1.5.22、PHP 5.3.3、Apache 2.2.3、Cent OS 5.8。该服务器还运行 Parallels Plesk Panel 10。

我希望有人能指出我的解决方案。

谢谢!

【问题讨论】:

  • 问题已经解决,尽管我不知道问题是什么。该脚本导致服务器出现分段错误。基本上,我们切换到没有 Plesk 的新服务器,它工作得很好。我不确定 plesk 是否是问题所在,或者 VPS 是否以某种方式损坏。我很想知道造成这种情况的原因,但不幸的是我没有时间弄清楚。

标签: php apache joomla centos joomla1.5


【解决方案1】:

检查 /var/log/httpd/suexec_log

和 /var/www/cgi-bin/cgi_wrapper/cgi_wrapper 的权限

应该是

ls -la /var/www/cgi-bin/cgi_wrapper/cgi_wrapper

-rwxr-xr-x 1 根 5288 2011 年 7 月 14 日 /var/www/cgi-bin/cgi_wrapper/cgi_wrapper

【讨论】:

  • 感谢您的回复。我在网上看到了这个答案。不幸的是,这对我没有帮助,权限配置正确。
猜你喜欢
  • 2012-09-23
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-11-01
  • 2012-06-25
  • 2012-04-07
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多