Perl (CGI Scripts)

bbennett

Active Member
#1
Hello,

I got everything working smoothly so far. I’m using litespeed as a replacement to apache on cpanel servers.

My last issue seems to be getting perl cgi scripts to work. I found the following page and have installed the FCGI. (perl -MCPAN -e 'install FCGI')

I’m just confused at to where in the web admin console I add the mappings to make this work.

http://www.litespeedtech.com/support/wiki/doku.php?id=apache_mod_perl_equivalent
 

mistwang

LiteSpeed Staff
#2
You can run perl script either as plain CGI script in suEXEC mode, or run it within the our Perl FCGI container as the user/group of the web server run as, "nobody/nobody".
To run perl CGI script as plain CGI, just add a server level script handler for "pl", using CGI as the handler.

To use the perl container, you need to add a FCGI external application similar to the lsphp external application, then use this external application as the handler for "pl"script.
 

mistwang

LiteSpeed Staff
#6
A sample perld configuration:
Code:
    <extProcessor>
      <type>fcgi</type>
      <name>lsperld</name>
      <address>uds://tmp/lsperld.sock</address>
      <note></note>
      <maxConns>20</maxConns>
      <env>FCGI_PERL_MAX_REQ=1000</env>
      <initTimeout>60</initTimeout>
      <retryTimeout>0</retryTimeout>
      <persistConn>1</persistConn>
      <pcKeepAliveTimeout>30</pcKeepAliveTimeout>
      <respBuffer>0</respBuffer>
      <autoStart>1</autoStart>
      <path>$SERVER_ROOT/fcgi-bin/lsperld.fpl</path>
      <backlog>20</backlog>
      <instances>20</instances>
      <runOnStartUp></runOnStartUp>
      <extMaxIdleTime>60</extMaxIdleTime>
      <priority></priority>
      <memSoftLimit>100M</memSoftLimit>
      <memHardLimit>150M</memHardLimit>
      <procSoftLimit></procSoftLimit>
      <procHardLimit></procHardLimit>
    </extProcessor>
 

Dat

New Member
#9
A sample perld configuration:
Code:
    <extProcessor>
      <type>fcgi</type>
      <name>lsperld</name>
      <address>uds://tmp/lsperld.sock</address>
      <note></note>
      <maxConns>20</maxConns>
      <env>FCGI_PERL_MAX_REQ=1000</env>
      <initTimeout>60</initTimeout>
      <retryTimeout>0</retryTimeout>
      <persistConn>1</persistConn>
      <pcKeepAliveTimeout>30</pcKeepAliveTimeout>
      <respBuffer>0</respBuffer>
      <autoStart>1</autoStart>
      <path>$SERVER_ROOT/fcgi-bin/lsperld.fpl</path>
      <backlog>20</backlog>
      <instances>20</instances>
      <runOnStartUp></runOnStartUp>
      <extMaxIdleTime>60</extMaxIdleTime>
      <priority></priority>
      <memSoftLimit>100M</memSoftLimit>
      <memHardLimit>150M</memHardLimit>
      <procSoftLimit></procSoftLimit>
      <procHardLimit></procHardLimit>
    </extProcessor>
Thanks for your sample! I am new to litespeed

I have setup a fast cgi mode for my existing perl script. There is no errors but it seems the script is still running in cgi mode, not Fast cgi mode because the %ENV variable is still the same and the $SERVER_ROOT/fcgi-bin/lsperld.fpl does NOT get fired on any request to cgi script via url.

Please advise!

Thanks!

Dat
 

Dat

New Member
#11
you may miss this step:
Thanks for your reply. I was able to do that last weekends and it's also working.

The only problem now is the cgi script in /cgi-bin does not affect. That is they are still running as cgi mode, NOT fastcgi mode. What will I have to do to get these scripts to work as mode fast cgi/

thanks again!

Dat
 

Dat

New Member
#13
is your vhost native or come from apache's httpd.conf ?
if from httpd.conf, grep "cgi-bin", see if directives like
ScriptAlias /cgi-bin/ /web/cgi-bin/
is there. if it exists, remove or comment out it.
refer apache document:
http://httpd.apache.org/docs/2.2/mod/mod_alias.html#scriptalias

if native vhost, check under vhost->Context tab, if there is any "CGI" type context, if it exists, remove it and try again.
Thanks NiteWave,

That helps. The the conf file is from apache and cpanel.

I will test that to see if it's working.

Cheers,

Dat
 
Top