【发布时间】:2019-08-11 17:22:57
【问题描述】:
我有以下 docker-compose 文件:
version: '2'
services:
test:
image: httpd
container_name: inc_test
ports:
- "3000:80"
environment:
- PERL5LIB=/somedir
- PERLLIB=/somedir
command:
- bash
- -c
- |
cat /usr/local/apache2/conf/httpd.conf | grep modules/mod_cgid.so
sed -i 's,#\(LoadModule cgid_module modules/mod_cgid.so\),\1,g' /usr/local/apache2/conf/httpd.conf
cat /usr/local/apache2/conf/httpd.conf | grep modules/mod_cgid.so
echo '#!/usr/bin/env perl' >> /usr/local/apache2/cgi-bin/test.pl
echo 'print "Content-type: text/html\n\n";' >> /usr/local/apache2/cgi-bin/test.pl
echo 'print join("\n", @INC);' >> /usr/local/apache2/cgi-bin/test.pl
ls -lah /usr/local/apache2/cgi-bin/test.pl
cat /usr/local/apache2/cgi-bin/test.pl
httpd -M | grep -e cgid -e alias
chmod a+x /usr/local/apache2/cgi-bin/test.pl
perl -le 'print for @INC'
echo "Which perl : "
which perl
httpd-foreground
当我转到http://localhost:3000/cgi-bin/test.pl 时,我看到/somedir 不在@INC 中。但是perl -le 'print for @INC' 包含/somedir。
什么鬼?
【问题讨论】:
-
您是否安装了多个 Perl?您是否在不同的用户帐户下运行?在不同的情况下,环境不会从一个用户复制到另一个用户。在命令行对两个用户进行测试,看看他们在
@INC中是否有相同的东西
标签: apache perl docker environment-variables cgi