I've got a working mod_perl installation on Ubuntu 10.O4. I've done the following things to get it working.
First i've created a file "/etc/apache2/site-available/yoursite" with following configuration:"
<VirtualHost *:80>
ServerName yoursite
ServerAdmin webmaster@localhost
DocumentRoot /var/www/yoursite
PerlModule ModPerl::Registry
<Location />
SetHandler perl-script
PerlResponseHandler ModPerl::Registry
Options +ExecCGI
</Location>
ErrorLog /var/log/apache2/error.log
# Possible values include: debug, info, notice, warn, error, c
+rit,
# alert, emerg.
LogLevel warn
CustomLog /var/log/apache2/access.log combined
</VirtualHost>
Note that i create a virtual host with a given name. To make sure that the site is visible, add a following line in your "/etc/hosts":
127.0.0.1 yoursite.localdomain yoursite
Now create the directory "/var/www/yoursite", make sure it is readable by user "www-data", and create a file "test.pl" with following content:
use Apache2::RequestUtil;
my $r = Apache2::RequestUtil->request;
$r->content_type("text/html");
$r->print("mod_perl rules!");
Note i've removed the "$r->send_http_header" line. It is not a valid method anymore under mod_perl2.
Restart your apache server.
This should give, when going to "http://yoursite/perl.pl", the text "mod_perl rules!".
Hope this helps.
Kind regards
Martell |