Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Next revision Both sides next revision | ||
litespeed_wiki:other-ext-apps:apache-mod-perl-equivalent [2018/04/10 19:56] Lisa Clarke Proofreading |
litespeed_wiki:other-ext-apps:apache-mod-perl-equivalent [2019/04/24 18:54] Jackson Zhang [lscgid: execve() No such file error] |
||
---|---|---|---|
Line 90: | Line 90: | ||
SERVER_SOFTWARE = LiteSpeed | SERVER_SOFTWARE = LiteSpeed | ||
</code> | </code> | ||
- | ==== Troubleshooting ==== | + | ===== Troubleshooting ===== |
+ | ==== Installation error ==== | ||
Without the ''perl-CPAN'' package installed, installation may run into the following error: | Without the ''perl-CPAN'' package installed, installation may run into the following error: | ||
Can't locate CPAN.pm 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 .). | Can't locate CPAN.pm 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 .). | ||
Line 99: | Line 100: | ||
[STDERR] Can't locate FCGI.pm 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 .) at /usr/local/lsws/fcgi-bin/lsperld.fpl line 3 | [STDERR] Can't locate FCGI.pm 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 .) at /usr/local/lsws/fcgi-bin/lsperld.fpl line 3 | ||
+ | ==== lscgid: execve() No such file error ==== | ||
+ | Run a simple test perl script on cpanel server but it runs into the following error and generates 500 error code. | ||
+ | lscgid: execve():/home/user1/public_html/test.pl: No such file or directory | ||
+ | | ||
+ | {{ :litespeed_wiki:other-ext-apps:perl-lscgid-execve-nosuchfile-error.png?600 |}} | ||
+ | Check the file and /home/user1/public_html/test.pl does exit. Why it still errors out as ''No such file or directory''? | ||
+ | |||
+ | Inspect the file by vi: | ||
+ | cd /home/user1/public_html/ | ||
+ | vi test.pl | ||
+ | | ||
+ | It shows ''^M'' at the end of each line, which means it is a dos/windows format, not unix format: | ||
+ | #!/usr/bin/perl^M | ||
+ | print "Content-type:text/html\n\n";^M | ||
+ | print <<EndOfHTML;^M | ||
+ | <html><head><title>Perl Environment Variables</title></head>^M | ||
+ | <body>^M | ||
+ | <h1>Perl Environment Variables</h1>^M | ||
+ | EndOfHTML^M | ||
+ | foreach $key (sort(keys %ENV)) {^M | ||
+ | print "$key = $ENV{$key}<br>\n";^M | ||
+ | }^M | ||
+ | print "</body></html>"; | ||
+ | |||
+ | To further test: | ||
+ | [[ $(file test.pl) =~ CRLF ]] && echo dos | ||
+ | It returns: | ||
+ | dos | ||
+ | |||
+ | Because of the difference of dos vs unix format, LiteSpeed lscgid can not recognise ''test.pl'' file and output ''No such file or directory''. | ||
+ | |||
+ | To fix the issue, you will need to convert dos format to Unix. There are many ways to do so, the following ''awk'' command is just one of them: | ||
+ | mv test.pl test.pl.dos | ||
+ | awk 'sub("$", "\r")' test.pl.dos > test.pl | ||
+ | |||
+ | You can verify the file format by ''vi test.pl'' and you don't see trailing ''^M'' in each line any more. | ||
+ | |||
+ | #!/usr/bin/perl | ||
+ | print "Content-type:text/html\n\n"; | ||
+ | print <<EndOfHTML; | ||
+ | <html><head><title>Perl Environment Variables</title></head> | ||
+ | <body> | ||
+ | <h1>Perl Environment Variables</h1> | ||
+ | EndOfHTML | ||
+ | foreach $key (sort(keys %ENV)) { | ||
+ | print "$key = $ENV{$key}<br>\n"; | ||
+ | } | ||
+ | |||
+ | |||
+ | After the convertion, perl script is working perfectly. |