3

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

这是我对带有 apache2 的虚拟主机的配置:

<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

没有身体。

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

谢谢你。

4

2 回答 2

0

尽管您可能不希望正文为空,但您的 HTTP 响应似乎没有发生错误情况。您可以查看命令行调用和 HTTP 调用之间的不同之处。用于此目的的一个工具是 Apache 的printenv 示例 CGI 脚本

于 2012-08-26T18:45:22.283 回答
0

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

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

于 2018-06-28T09:41:39.167 回答