Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: How to configure mod_perl?

by martell (Hermit)
on Jun 17, 2011 at 21:48 UTC ( [id://910265]=note: print w/replies, xml ) Need Help??


in reply to How to configure mod_perl?

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

Replies are listed 'Best First'.
Re^2: How to configure mod_perl?
by aanriot (Sexton) on Jun 18, 2011 at 08:31 UTC
    And as rifat mentionned, be sure to have mod_perl loaded. If the file /etc/apache2/mods-enabled/perl.load does not exist, run a2enmod perl (it's better than a symlink), and reload Apache.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://910265]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (2)
As of 2024-04-25 20:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found