PhillipHuang has asked for the wisdom of the Perl Monks concerning the following question:
I have already installed Spreadsheet::ParseExcel and Spreadsheet::WriterExcel by CPAN. When I run the perl script in command line, it runs well and return as expected. However, As run as CGI script(result.pl) by Web browser, the error messages shows
[cgi:error] [pid 4778] [client 192.168.1.104:52082] AH01215: Can't loc +ate Spreadsheet/ParseExcel.pm in @INC (@INC contains: /usr/local/lib6 +4/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/shar +e/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at /var/www/ +cgi-bin/result.pl line 11.
I am sure the Spread modules are installed, and find them as the below directory:
[root@localhost ~]# find / -name 'Parser.pm' /usr/share/perl5/vendor_perl/TAP/Parser.pm /home/phillip/.cpan/build/HTML-Parser-3.72-Vmh_1r/Parser.pm /home/phillip/.cpan/build/HTML-Parser-3.72-Vmh_1r/blib/lib/HTML/Parser +.pm /home/phillip/perl5/lib/perl5/x86_64-linux-thread-multi/HTML/Parser.pm
As googled items, I try to add the path to @INC by
the http error_log still shows#result.pl use lib qw(/home/phillip/perl5/lib/perl5); use Spreadsheet:ParseExcel;
"[cgi:error] [pid 1055] [client 192.168.1.104:56670] AH01215: Can't lo +cate Spreadsheet/ParseExcel.pm in @INC (@INC contains: /home/phillip/ +perl5/lib/perl5 /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/li +b64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 / +usr/share/perl5 .) at /var/www/cgi-bin/result.pl line 10., referer: h +ttp://192.168.1.143/ [Thu May 09 00:02:21.333414 2019] [cgi:error] [pid 1055] [client 192.1 +68.1.104:56670] AH01215: BEGIN failed--compilation aborted at /var/ww +w/cgi-bin/result.pl line 10., referer: http://192.168.1.143/"
Why run well in command line by root, and why failed by web browser? I guess perhaps it is caused by privileges, apache user can not invisit the part which owner is root. Would you please give any hint? How to resolve this? Thanks in advanced,
PH2019-05-09 Athanasius fixed code tags
|
|---|