【发布时间】:2014-10-18 23:02:33
【问题描述】:
我在 centos 上使用 apache 和 mod_perl 2,我的 apache 配置文件中有一个 PerlRequire 指令来指定我的 mod_perl 启动文件:
PerlRequire startup.pl
但是,当我尝试启动 apache 时,mod_perl 在其 perl 包含路径中找不到 startup.pl。 apache 错误日志说:
[error] Can't locate startup.pl in @INC (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 . /etc/httpd) at (eval 2) line 1.
mod_perl 2 文档说有一个 PerlSetEnv 指令可用于设置环境变量, 可以为此目的设置http://perl.apache.org/docs/2.0/user/config/config.html#C_PerlSetEnv_ 和 PERL5LIB 环境变量,如下所述:http://learn.perl.org/faq/perlfaq8.html#How_do_I_add_the_dir 但是如果已经设置了 PERL5LIB 变量,那么我不想破坏以前的设置,而是想向它添加另一个目录。我可以在我的 apache 配置文件中使用什么指令来添加一个目录到 perl 包含路径 (@INC) 而不会破坏其以前的内容?
编辑:@jm666 在 apache 配置中使用“PerlSwitches -I/some/other/path”的答案听起来像是正确的答案,尽管另一种可能性是在我的 PerlRequire 指令中使用 startup.pl 的完整路径.但是,从 startup.pl 执行此操作的其他建议答案将不起作用,因为 mod_perl 找不到的是 startup.pl。
【问题讨论】:
-
把完整路径放到
PerlRequire -
您是否尝试将
SetEnv PERL5LIB /path/to/lib:$PERL5LIB添加到您的httpd.conf 中?
标签: apache perl mod-perl mod-perl2