Fred Sullet
Fred Sullet

Reputation: 371

ModPerl::Registry - Cannot run CGI perl script

I'm under Apache 2.4.7 and Ubuntu 14.04.

I'm trying to run the following basic perl script (/home/fred/workspace/portfolio/cgi/fred.pl) under ModPerl::Registry but it won't execute (the browser treats it as a file to download, not a perl script)

#!/usr/bin/perl

print "Content-type: text/html\n\n";
print "Hi Fred !";

This is my virtual host configuration :

<VirtualHost 127.0.0.1:80>
        ServerAdmin webmaster@localhost
        DocumentRoot /home/fred/workspace/portfolio/html

AddHandler perl-script .cgi .pl
PerlModule ModPerl::Registry
Alias / /home/fred/workspace/portfolio/cgi/
<Location />
        SetHandler perl-script
        PerlHandler ModPerl::Registry
        Require all granted
        Options +ExecCGI
</Location>

I previously run

sudo a2enmod cgi

which actually enabled cgid (my apache is threaded), fine.

when I type 127.0.0.1/fred.pl, no execution (fred.pl has rights 777)

Upvotes: 0

Views: 863

Answers (3)

Badrri
Badrri

Reputation: 33

In your httpd.conf file, you need to add the following line

LoadModule cgid_module modules/mod_cgid.so

This enables execution of CGI scripts in apache httpd server.

You also need to add the following line perl CGI execution permission.

PerlSwitches -w

Upvotes: 0

OGATA Tetsuji
OGATA Tetsuji

Reputation: 44

Fist, PerlHandler handler is mod_perl1 directive. mod_perl2 has PerlResponseHandler handler alternative.

So following is right:

PerlResponseHandler ModPerl::Registry

And did you load mod_perl.so? When you use Ubuntu, then type:

sudo a2enmod perl

or write suitable LoadModule line and restart server.

Maybe, there is other problem. However I do not have enough information.

Finally I advice that mod_perl2 does not official support Apache 2.4 on now (Dec 2014).

Upvotes: 0

Perrin Harkins
Perrin Harkins

Reputation: 221

The first thing I'd check is that you've got the right apache config file. (Simple way to check: put in a syntax error and see if it complains when you restart the server.)

If it's the right file, then you have an issue with your config directives. It's hard to debug those without seeing the whole file. You could try starting with a very simple config section, like the one here.

I would probably turn off cgid until you get this working as well.

Upvotes: 0

Related Questions