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 [2019/04/24 18:54] Jackson Zhang [lscgid: execve() No such file error] |
litespeed_wiki:other-ext-apps:apache-mod-perl-equivalent [2020/08/27 18:30] Jackson Zhang [For a Control Panel Environment] |
||
---|---|---|---|
Line 10: | Line 10: | ||
{{ :litespeed_wiki:other-ext-apps:lsperld-ext-app-handler.png?600 |}} | {{ :litespeed_wiki:other-ext-apps:lsperld-ext-app-handler.png?600 |}} | ||
+ | |||
+ | |||
+ | <extProcessor> | ||
+ | <type>fcgi</type> | ||
+ | <name>PerlFastCGI</name> | ||
+ | <address>uds://tmp/lshttpd/perl.sock</address> | ||
+ | <maxConns>35</maxConns> | ||
+ | <env>FCGI_PERL_MAX_REQ=1000</env> | ||
+ | <env>LSAPI_CHILDREN=35</env> | ||
+ | <initTimeout>60</initTimeout> | ||
+ | <retryTimeout>0</retryTimeout> | ||
+ | <persistConn>1</persistConn> | ||
+ | <pcKeepAliveTimeout>30</pcKeepAliveTimeout> | ||
+ | <respBuffer>0</respBuffer> | ||
+ | <autoStart>1</autoStart> | ||
+ | <path>/usr/local/lsws/fcgi-bin/lsperld.fpl</path> | ||
+ | <backlog>100</backlog> | ||
+ | <instances>1</instances> | ||
+ | <memSoftLimit>2074M</memSoftLimit> | ||
+ | <memHardLimit>2074M</memHardLimit> | ||
+ | <procSoftLimit>400</procSoftLimit> | ||
+ | <procHardLimit>500</procHardLimit> | ||
+ | </extProcessor> | ||
+ | |||
+ | <scriptHandler> | ||
+ | <suffix>pl</suffix> | ||
+ | <type>fcgi</type> | ||
+ | <handler>PerlFastCGI</handler> | ||
+ | </scriptHandler> | ||
+ | |||
+ | |||
Restart LiteSpeed Web Server. | Restart LiteSpeed Web Server. | ||
Line 92: | Line 123: | ||
===== Troubleshooting ===== | ===== Troubleshooting ===== | ||
- | ==== Installation error ==== | + | ==== Installation error on LSWS native ==== |
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 101: | Line 132: | ||
==== lscgid: execve() No such file error ==== | ==== 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. | + | A simple test perl script on a cPanel server runs into the following error and generates a 500 error code: |
lscgid: execve():/home/user1/public_html/test.pl: No such file or directory | 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 |}} | {{ :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''? | + | But ''/home/user1/public_html/test.pl'' //does// exist. So why the ''No such file or directory'' error? |
+ | |||
+ | Inspect the file in vi: | ||
- | Inspect the file by vi: | ||
cd /home/user1/public_html/ | cd /home/user1/public_html/ | ||
vi test.pl | vi test.pl | ||
| | ||
- | It shows ''^M'' at the end of each line, which means it is a dos/windows format, not unix format: | + | There is a ''^M'' at the end of each line, which means the file is in DOS/Windows format, not Unix format: |
#!/usr/bin/perl^M | #!/usr/bin/perl^M | ||
print "Content-type:text/html\n\n";^M | print "Content-type:text/html\n\n";^M | ||
Line 125: | Line 159: | ||
print "</body></html>"; | print "</body></html>"; | ||
- | To further test: | + | To test further, try: |
[[ $(file test.pl) =~ CRLF ]] && echo dos | [[ $(file test.pl) =~ CRLF ]] && echo dos | ||
+ | |||
It returns: | It returns: | ||
dos | 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''. | + | Because of the difference in DOS vs Unix format, LiteSpeed lscgid can not recognize the ''test.pl'' file. Hence the ''No such file or directory'' error. |
+ | |||
+ | To fix the issue, you will need to convert from DOS format to Unix. There are many ways to do so, including the following ''awk'' command: | ||
- | 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 | mv test.pl test.pl.dos | ||
awk 'sub("$", "\r")' test.pl.dos > test.pl | 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. | + | You can inspect ''test.pl'' again in vi to verify the file format. You should no longer see the trailing ''^M'' in each line. |
#!/usr/bin/perl | #!/usr/bin/perl | ||
Line 149: | Line 186: | ||
} | } | ||
- | + | After the conversion, you should find the perl script is working perfectly. | |
- | After the convertion, perl script is working perfectly. | + |