Perl .pl file downloads instead of being executed

9,412

Solution 1

Make sure you have set the following path in your /etc/apache2/apache2.conf:
ScriptAlias /cgi-bin/ "/path/to/cgi-bin/" and that your scripts are in that folder.

If your scripts ends on .pl make sure to change the line
AddHandler cgi-script .cgi to AddHandler cgi-script .cgi .pl
in /etc/apache2/apache2.conf and check that it is not commented out.

Options FollowSymLinks +ExecCGI needs to set in your virtual host.

Solution 2

Waking the dead but with the answer. Do this:

ln -s /etc/apache2/mods-available/cgid.load /etc/apache2/mods-enabled/
ln -s /etc/apache2/mods-available/cgid.conf /etc/apache2/mods-enabled/

sudo service apache2 restart

and it works.

Share:
9,412

Related videos on Youtube

SPRBRN
Author by

SPRBRN

Updated on September 18, 2022

Comments

  • SPRBRN
    SPRBRN over 1 year

    I'm trying to get OTRS 4.0 working on Ubuntu 14.04. I've followed all instructions to install from source.

    When I open the site (localhost/otrs/index.pl), an empty .pl-file is served for download. Apparently Apache finds the index.pl, but does not know what to do with it.

    • OTRS is installed with all relevant perl modules (checked by install script)
    • Vhost is copied from scripts folder in OTRS
    • hosts is updated for the local test domain
    • Apache is restarted

    Modules

    cgi.load -> ../mods-available/cgi.load
    perl.load -> ../mods-available/perl.load
    

    Question

    How can I get Perl working with Apache?

  • SPRBRN
    SPRBRN about 9 years
    Thanks for the reply! There was no AddHandler in apache2.conf. I've added it. There was no ScriptAlias either. OTRS has its own ScriptAlias for cgi-bin: ScriptAlias /otrs/ "/opt/otrs/bin/cgi-bin/". So this alias should point to the OTRS cgi-bin? Adding the cgi-bin ScriptAlias doesn't change anything after a restart.
  • Pabi
    Pabi about 9 years
    I just had a chance to take a more detailed look at OTRS. All necessary config is allready provided in the /opt/otrs/scripts/apache2-httpd.include.conf. Have you copied that file to your /etc/apache2/conf-available directory and enabled it with a2ensite apache2-httpd.include?
  • App
    App almost 8 years
    Or a2enmod cgid