【问题标题】:No errors inside apache error.log when perl script fail当 perl 脚本失败时,apache error.log 中没有错误
【发布时间】:2012-08-21 09:23:45
【问题描述】:

我正在尝试调试为什么我的 index.pl 文件会生成错误,但在 apache 的错误日志中没有任何记录。如何正确设置我的环境以查看发生了什么? 我不认为是文件权限的问题。

这是我使用 apache2 对 vhost 的配置:

<VirtualHost *:80>
    ServerName test_perl
    DocumentRoot /var/www/test
    ErrorLog /var/www/test/error_test.log
    LogLevel debug

   <Directory />
       AllowOverride All
       Options All -Indexes +ExecCGI
       AddHandler perl-script .pl
       PerlHandler ModPerl::Registry
       PerlSendHeader On
   </Directory>
</VirtualHost>

这是 HTTP 响应:

HTTP/1.1 200 OK
Date: Sun, 26 Aug 2012 18:08:47 GMT
Server: Apache/2.2.22 (Ubuntu)
Content-Type: text/x-perl

没有身体。

但是当我使用命令行运行文件时,我可以看到错误。

谢谢。

【问题讨论】:

    标签: apache logging error-handling mod-perl


    【解决方案1】:

    虽然您可能不希望正文为空,但您的 HTTP 响应似乎没有出现错误情况。您可以查看命令行调用和 HTTP 调用之间的不同之处。用于此目的的一个工具是 Apache 的 printenv example CGI script

    【讨论】:

      【解决方案2】:

      默认情况下,所有 warnSTDERR 输出都会转到主 Apache 错误日志,而不是 vhost 配置中指定的 ErrorLog

      另见https://serverfault.com/questions/525627/on-apache2-mod-perl2-stderr-output-doesnt-go-to-logfile-nominated-by-errorlog/918627#918627

      【讨论】:

        猜你喜欢
        • 2011-01-09
        • 2016-08-02
        • 2015-12-01
        • 2017-02-11
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2016-12-10
        相关资源
        最近更新 更多