cgi-bin / perl not executing script

Discussion in 'ISPConfig 3 Priority Support' started by stargazer, May 2, 2014.

  1. stargazer

    stargazer Member HowtoForge Supporter

    I looked through the forums, and found several other descriptions of this problem but no resolution.

    ispconfig 3.0.5.3. I have cgi and perl turned on in site configuration. When I try to execute a perl script (.pl extension, '#! /usr/bin/perl -w is first line), it is downloaded instead of being executed. perl.load is in /etc/apache/mods-enabled.

    Configuration for one of the sites follows:

    <Directory /var/www/lakewoodtexas.com>
    AllowOverride None
    Order Deny,Allow
    Deny from all
    </Directory>

    <VirtualHost *:80>
    DocumentRoot /var/www/lakewoodtexas.com/web

    ServerName lakewoodtexas.com
    ServerAlias www.lakewoodtexas.com
    ServerAdmin [email protected]

    ErrorLog /var/log/ispconfig/httpd/lakewoodtexas.com/error.log

    Alias /error/ "/var/www/lakewoodtexas.com/web/error/"
    ErrorDocument 400 /error/400.html
    ErrorDocument 401 /error/401.html
    ErrorDocument 403 /error/403.html
    ErrorDocument 404 /error/404.html
    ErrorDocument 405 /error/405.html
    ErrorDocument 500 /error/500.html
    ErrorDocument 502 /error/502.html
    ErrorDocument 503 /error/503.html

    <IfModule mod_ssl.c>
    </IfModule>

    <Directory /var/www/lakewoodtexas.com/web>
    Options FollowSymLinks
    AllowOverride All
    Order allow,deny
    Allow from all
    </Directory>
    <Directory /var/www/clients/client9/web16/web>
    Options FollowSymLinks
    AllowOverride All
    Order allow,deny
    Allow from all
    </Directory>


    <IfModule mod_perl.c>
    PerlModule ModPerl::Registry
    PerlModule Apache2::Reload
    <Directory /var/www/lakewoodtexas.com/web>
    PerlResponseHandler ModPerl::Registry
    PerlOptions +ParseHeaders
    Options +ExecCGI
    </Directory>
    <Files *.pl>
    SetHandler perl-script
    </Files>
    </IfModule>


    # cgi enabled
    <Directory /var/www/clients/client9/web16/cgi-bin>
    Order allow,deny
    Allow from all
    </Directory>
    ScriptAlias /cgi-bin/ /var/www/clients/client9/web16/cgi-bin/
    AddHandler cgi-script .cgi
    AddHandler cgi-script .pl
    # suexec enabled
    <IfModule mod_suexec.c>
    SuexecUserGroup web16 client9
    </IfModule>
    # Clear PHP settings of this website
    <FilesMatch "\.ph(p3?|tml)$">
    SetHandler None
    </FilesMatch>
    # php as fast-cgi enabled
    # For config options see: http://httpd.apache.org/mod_fcgid/mod/mod_fcgid.html
    <IfModule mod_fcgid.c>
    IdleTimeout 300
    ProcessLifeTime 3600
    # MaxProcessCount 1000
    DefaultMinClassProcessCount 0
    DefaultMaxClassProcessCount 100
    IPCConnectTimeout 3
    IPCCommTimeout 360
    BusyTimeout 300
    </IfModule>
    <Directory /var/www/lakewoodtexas.com/web>
    AddHandler fcgid-script .php .php3 .php4 .php5
    FCGIWrapper /var/www/php-fcgi-scripts/web16/.php-fcgi-starter .php
    Options +ExecCGI
    AllowOverride All
    Order allow,deny
    Allow from all
    </Directory>
    <Directory /var/www/clients/client9/web16/web>
    AddHandler fcgid-script .php .php3 .php4 .php5
    FCGIWrapper /var/www/php-fcgi-scripts/web16/.php-fcgi-starter .php
    Options +ExecCGI
    AllowOverride All
    Order allow,deny
    Allow from all
    </Directory>


    # add support for apache mpm_itk
    <IfModule mpm_itk_module>
    AssignUserId web16 client9
    </IfModule>

    <IfModule mod_dav_fs.c>
    # Do not execute PHP files in webdav directory
    <Directory /var/www/clients/client9/web16/webdav>
    <ifModule mod_security2.c>
    SecRuleRemoveById 960015
    SecRuleRemoveById 960032
    </ifModule>
    <FilesMatch "\.ph(p3?|tml)$">
    SetHandler None
    </FilesMatch>
    </Directory>
    DavLockDB /var/www/clients/client9/web16/tmp/DavLock
    # DO NOT REMOVE THE COMMENTS!
    # IF YOU REMOVE THEM, WEBDAV WILL NOT WORK ANYMORE!
    # WEBDAV BEGIN
    # WEBDAV END
    </IfModule>


    </VirtualHost>
     
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    There are 2 different ways to run perl cgi scripts in ISPConfig:

    1)

    Place the script in the folder /var/www/clients/client9/web16/cgi-bin and make the script executable by running:

    chmod +x yourscriptname.pl

    2) Pleace the script anywere in the web folder, if the perl script handling with mod_perl is enabed in the website settings, then perl scripts will work like php scripts outside of the cgi-bin directory.
     
  3. stargazer

    stargazer Member HowtoForge Supporter

    -rwxr-xr-x 1 web16 client9 375 Jan 17 22:08 signup.pl
    /var/www/clients/client9/web16/cgi-bin/signup.pl

    And, it still doesn't work.

    The link from the web page is:
    http://lakewoodtexas.com/cgi-bin/signup.pl

    As far as I can tell, it is set up correctly. It worked on the old server; I did verify that. The only two sites that are not working on the new (ISPConfig3) server are the Perl scripts as far as I can tell.

    Rod
     
  4. till

    till Super Moderator Staff Member ISPConfig Developer

    are you sure thet the apache cgi module is enabled? try a:

    a2enmod cgi
     
  5. stargazer

    stargazer Member HowtoForge Supporter

    cgi is enabled.
     
  6. Croydon

    Croydon ISPConfig Developer ISPConfig Developer

    Have you tried if it works when CGI mode is disabled an only Perl is enabled?
    I think the CGI option conflicts with perl enabled because of this line:
    Code:
    AddHandler cgi-script .pl
    You could try removing this manually from your vhost and restart apache to test if it is the reason.
     
  7. stargazer

    stargazer Member HowtoForge Supporter

    Solution

    I tried several things. Finally, I disabled "Perl" completely via the control panel (unchecked the box). At this point, it all appears to work.

    I'm not sure what this will effect, and I assume it will be running perl from the cli, not via apache mod, but at least it is working.

    I may have time to play with it later and see exactly what is causing the issue, but for anyone else looking at this, enable cgi-bin but do not enable Perl. That works on my system, at least.

    Rod
     

Share This Page