Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous 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 [2019/04/24 20:21]
Lisa Clarke [lscgid: execve() No such file error] Copyediting
Line 101: Line 101:
  
 ==== 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.+simple test perl script on a cPanel ​server runs into the following error and generates ​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 exitWhy it still errors out as ''​No such file or directory''?​+But ''​/​home/​user1/​public_html/​test.pl''​ //does// existSo 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 128:
   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 155:
   }    } 
  
- +After the conversionyou should find the perl script is working perfectly. ​
-After the convertion, perl script is working perfectly. ​+
  • Admin
  • Last modified: 2023/03/25 14:06
  • by Lisa Clarke