Mod perl

From ArchWiki
Jump to: navigation, search

Tango-document-new.pngThis article is a stub.Tango-document-new.png

Notes: please use the first argument of the template to provide more detailed indications. (Discuss in Talk:Mod perl#)

Enabling Perl + Apache

Install mod_perl from the official repositories.

Add this to httpd.conf:

LoadModule perl_module modules/

Add a virtual host with various settings in extra/httpd-vhosts.conf:

<VirtualHost perlwebtest:80>
	Servername perlwebtest
	DocumentRoot /srv/http/perlwebtest
	ErrorLog /var/log/httpd/perlwebtest-error.log
	CustomLog /var/log/httpd/perlwebtest-access.log combined
	<Directory /srv/http/perlwebtest>
		AddHandler perl-script .pl
		PerlResponseHandler ModPerl::Registry
		Options +ExecCGI
		PerlOptions +ParseHeaders
		AllowOverride All
		Order allow,deny
		Allow from all

Make sure you do not have "Options Indexes FollowSymLinks"!

Add "perlwebtest" as localhost in /etc/hosts:	localhost YOURHOSTNAME perlwebtest

Use your hostname instead of YOURHOSTNAME.

Create perl_module.conf as well (same directory as httpd-vhosts.conf):

# Required modules: dir_module, perl_module

<IfModule dir_module>
        <IfModule perl_module>
                DirectoryIndex index.html

Then include it in httpd.conf:

# Perl
Include conf/extra/perl_module.conf

Create in /srv/http/perlwebtest:

print "Content-type: text/plain\n\n";
print "mod_perl now works\n";

Restart apache:

# rc.d restart httpd

Usually you can just reload:

# rc.d reload httpd

Then visit http://localhost/.