What modules do I need to run perl CGI with apache?

9,985

I was able to solve that with :

$ sudo a2enmod cgi

from that answer https://askubuntu.com/a/54259/23006

Share:
9,985

Related videos on Youtube

Patryk
Author by

Patryk

Software Engineer C++/Go/shell/python coder Linux enthusiast Github profiles: https://github.com/pmalek https://github.com/pmalekn

Updated on September 18, 2022

Comments

  • Patryk
    Patryk over 1 year

    I have some CGI script using perl and I would like to make them work on Apache. I have the following installed :

    $ dpkg -l | grep perl | grep apach
    ii  libapache-session-perl               1.90-1                                                all          modules for keeping persistent user data across HTTP requests
    ii  libapache2-authcookie-perl           3.19-3                                                all          Perl Authentication and Authorization via cookies
    ii  libapache2-mod-perl2                 2.0.8+httpd24-r1449661-6ubuntu1                       i386         Integration of perl with the Apache2 web server
    ii  libapache2-mod-perl2-dev             2.0.8+httpd24-r1449661-6ubuntu1                       all          Integration of perl with the Apache2 web server - development files
    ii  libapache2-mod-perl2-doc             2.0.8+httpd24-r1449661-6ubuntu1                       all          Integration of perl with the Apache2 web server - documentation
    ii  libapache2-reload-perl               0.12-2                                                all          module for reloading Perl modules when changed on disk
    ii  libapache2-request-perl              2.13-2.1                                              i386         generic Apache request library - Perl modules
    ii  libapache2-sitecontrol-perl          1.05-1                                                all          perl web site authentication/authorization system
    

    And in /etc/apache2/apache2.conf I have added something like this :

    ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
    
    <Directory /usr/lib/cgi-bin/>
      Options Indexes FollowSymLinks
      Options +ExecCGI
      #AllowOverride None
      Require all granted
      AddHandler cgi-script cgi pl
    </Directory>
    

    After that I get the script contents in the browser instead of getting it executed.

    The mentioned script has the following permissions :

    -rwxr-xr-x 1 root root 30146 mar  7 19:17 /usr/lib/cgi-bin/status.pl
    

    If I put the following link

    $ ll /etc/apache2/mods-enabled/cgi.load  
    lrwxrwxrwx 1 root root 26 mar  7 21:40 /etc/apache2/mods-enabled/cgi.load -> ../mods-available/cgi.load
    

    Then I get Error server 500.