run lxr perl module as scripts under apache 2.4

240 Views Asked by At

I have been trying to get it right for the past couple of days, but could not. I am not a LAMP guy.

I installed Apache 2 from the default Ubuntu repositories. Here is the contents of the /etc/apache2 directory:

/etc/apache2$ ls
apache2.conf    conf-enabled  magic           mods-enabled  sites-available
conf-available  envvars       mods-available  ports.conf    sites-e

And here are the contents of the sites-enabled directory:

/etc/apache2/sites-enabled$ ls
000-default.conf

Here is what I added to 000-default.conf:

Alias "/lxr" "/usr/local/share/lxr"

<Location /lxr>
    allow from all
    Require all granted
</Location>

And here is the contents of the perl module at this link.

My problem is: when I visit the link http://localhost/lxr/source , I get it as a text file, it is not executed as a script.

How can I fix this?

Thank you!

1

There are 1 best solutions below

0
On

You have first to install mod_perl on your system. If you are in a debian-like distribution, suche as ubuntu, you can use :

sudo apt-get install libapache2-mod-perl2

Then enable this module on apache :

sudo a2enmod perl

and restart the apache server

sudo service apache2 restart

You will also have to add some configuration such as :

  PerlModule Apache::Registry
  Alias /cgi-bin/ /usr/lib/cgi-bin
  <Location /cgi-bin>
    SetHandler perl-script
    PerlHandler Apache::Registry
    PerlSendHeader On
    Options +ExecCGI
  </Location>

Read this article for more information.