Perl not working with ISPConfig 3

Discussion in 'Installation/Configuration' started by martin.macko.47, Feb 10, 2014.

  1. martin.macko.47

    martin.macko.47 New Member

    Hello, I started using ISPConfig few days ago, and it's wonderful. However, I can't get perl scripts to work.

    For instance, let's create a new website with both CGI and Perl enabled, upload a simple hello world testing perl script hello.pl to /var/www/domain.com/cgi-bin/ and make it executable. Then, when I open http://www.domain.com/cgi-bin/hello.pl, the script source code gets downloaded instead of being executed. The same happens, if I upload hello.pl to /var/www/domain.com/web/, and open http://www.domain.com/hello.pl. No errors logged in /var/www/domain.com/logs/*.log nor /var/log/apache2/*.log.

    If I look at /etc/apache2/sites-enabled/100-domain.com.vhost genereted by ISPConfig, there is a section:
    Code:
    <VirtualHost *:80>
        [...]
        <IfModule mod_perl.c>
            PerlModule ModPerl::Registry
            PerlModule Apache2::Reload
            <Directory [B]/var/www/domain.com/web[/B]>
                PerlResponseHandler ModPerl::Registry
                PerlOptions +ParseHeaders
                Options +ExecCGI
            </Directory>
            <Files *.pl>
                SetHandler perl-script
            </Files>
        </IfModule>
        [...]
    </VirtualHost>
    So, imho, according to this section, perl scripts should work even outside cgi-bin, but they don't, why? However, I noticed that if I change the Directory path from /var/www/poleno.sk/web to /var/www/clients/client1/web1/web, the scripts begin to work. So, why don't they work with the former path, or how do I make ISPConfig generate 100-domain.com.vhost with the working path in the directory section? It's not good solution just to adjust 100-domain.com.vhost manually, as it gets regenerated by ISPConfig after every client change to the website configuration.

    To make sure the perl module is enabled:
    Code:
    [email protected]:~# apache2ctl -M | grep perl
     perl_module (shared)
    I'm using fully updated fresh install of:
    • Ubuntu server 12.04.3 LTS (64bit)
    • Apache 2.2.22-1ubuntu1.4
    • ISPConfig 3.0.5.3
    Installed following The Perfect Server - Ubuntu 12.04 LTS (Apache2, BIND, Dovecot, ISPConfig 3) tutorial.

    The simple hello world perl script I used, for reference:
    Code:
    #!/usr/bin/perl
    print "Content-type: text/html\n\n";
    print "Hello, world!\n";
     
  2. till

    till Super Moderator Staff Member ISPConfig Developer

  3. martin.macko.47

    martin.macko.47 New Member

    Thanks for adding it to the bugtracker. Should I post my thoughts why it's not working here or to the bugtracker?

    More bothers me now that perl isn't working outside cgi-bin than inside. As far as I understand the configuration generated by ISPConfig, I guess it was ment to work outide cgi-bin, wasn't it? At least this <Directory> directive found in /etc/apache2/sites-enabled/100-domain.com.vhost suggests so:
    Code:
    [...]
    <VirtualHost *:80>
        [...]
        [B]DocumentRoot /var/www/clients/client1/web1/web[/B]
        ServerName domain.com
        [...]
        <IfModule mod_perl.c>
            PerlModule ModPerl::Registry
            PerlModule Apache2::Reload
            <[B]Directory /var/www/domain.com/web[/B]>
                PerlResponseHandler ModPerl::Registry
                PerlOptions +ParseHeaders
                Options +ExecCGI
            </Directory>
            <Files *.pl>
                SetHandler perl-script
            </Files>
        </IfModule>
        [...]
    </VirtualHost>
    
    However, the path in the Directory directive is different than DocumentRoot path. The latter uses symlink, while the former doesn't. But, for apache, they are completly different paths with completly different configurations and therefore the Directory directive doesn't apply to the DocumentRoot.

    As the Apache documentation says:
    I suggest to always use canonical paths in the configuration, so Apache won't get confused by different symlinked paths to the same website root.

    I've just found out that the same applies for Ruby and Python scripts placed outside cgi-bin. Their respective directory directives in the configuration file suggest they was ment to work outside cgi-bin, but because of the symlinked paths in their arguments, they don't.

    Could somebody, please, check it on some other system? I am using Ubuntu 12.04.3 LTS with Apache 2.2.22 and ISPConfig 3.0.5.3. I'm afraid, the problem is not particular to Ubuntu. I would guess the same problem on other systems as well. However, I have no means to test it elsewhere. Thanks.
     
  4. till

    till Super Moderator Staff Member ISPConfig Developer

    The problem is fixed now in git stable branch.
     

Share This Page