Installing Apache2/Modperl on Ubuntu 12.04
apt-get install apache2 apt-get install libapache2-mod-perl2 apt-get install perl-debug apt-get install libapache2-mod-perl2-dev apt-get install libapache2-request-perl libdatetime-perl
Edit /etc/apache2/sites-available/default, add:
<Location /perl/> SetHandler perl-script PerlHandler ModPerl::PerlRun Options ExecCGI PerlSendHeader On allow from all </Location>
Install the CGI module:
cpan install CGI
Create a directory /var/www/perl. Add a script, for example:
#!/usr/bin/perl use CGI; # load CGI routines $q = CGI->new; # create new CGI object print $q->header, # create the HTTP header $q->start_html('hello world'), # start the HTML $q->h1('hello world'), # level 1 header $q->end_html; # end the HTML
Call it something like hello.pl. Try to access http://server/perl/hello.pl, everything should work correctly.
Okay, I have this AMD virtual hosts set up, so when I go into mystify/perl I have two scripts, neither work…I followed this to the T
Since my vhost is at /var/www/site1 would I have to edit Location /perl to /location /site1/perl ?
Oops, I want to be notified by email, so reply to this one…
apt-get install apache2 libapache-mod-perl2Reading package lists… Done
Building dependency tree
Reading state information… Done
E: Unable to locate package libapache-mod-perl2
please help me!!!!!!!!!!!!!!!!
libapache2-mod-perl2
you’ve forgotten to add ‘2’ after libapache 🙂
I think that for newer machines/OSs
/etc/apache2/sites-available/default
is
/etc/apache2/sites-available/000-default.conf