Results 1 to 5 of 5
Hiya.
I'm currently running a HTTP web-server on my Ubuntu (10.04) machine at the minute - mainly for practising PHP scripts as well as Perl CGI scripts and PHP works ...
- 09-07-2010 #1Just Joined!
- Join Date
- Dec 2008
- Posts
- 35
Perl refuses to work in Ubuntu server (lamp-server)
Hiya.
I'm currently running a HTTP web-server on my Ubuntu (10.04) machine at the minute - mainly for practising PHP scripts as well as Perl CGI scripts and PHP works just fine after installing libapache-mod-php5 but when I do the same for Perl (libapache-mod-perl2) my Perl CGI files refuse to work.
All configuration files are currently left at their defaults after installing lamp-server though I've browsed through /etc/apache/apache2.conf as well as /etc/apache2/httpd.conf which is mentioned in a few documentation files on the internet but that is empty. I'm using the default server root at /var/www since I'm only using this web-server for practising coding skills as well as learning more and apache2 is only turned on while I'm doing this so there's no security issues with it this way.
So my problem is when I browse to http://localhost/perl_test.pl it displays a download window asking me whether I'd like to either download or view my Perl file - neither of which I want to do, just run the file in my web-browser.
At first I considered it possibly be compilation errors for my Perl script so I tried running perl perl_test.pl and it works okay in the terminal, so it's probably an Apache2 config'. I'm not too knowledgable about these config files but I have looked and cgi-bin is in /var/lib/cgi-bin which is supposedly lamp-server's default so would anybody know what my problem is?
I've looked and tried many things but it doesn't work.
Oh. And for confirmation purposes this is all my script contains:
Code:#!usr/bin/perl #cgihi.pl use strict; use warnings; print "Content-type: text/plain\n\n"; print "Does it wor?"; print "IP: . $ENV{REMOTE_ADDR}\n";
- 09-07-2010 #2
#!usr/bin/perl
#!/usr/bin/perl
- 09-08-2010 #3Just Joined!
- Join Date
- Dec 2008
- Posts
- 35
That was just a typo when I was typing out the post above. The script is exactly how it should be and to confirm this I have changed it countless amount of times.
I can't even print plain text to the client with a Perl script at the minute even after following these instructions
- 09-08-2010 #4
Try adding
to /etc/apache2/sites-available/default and then bouncing the apache service. This used to be sudo /etc/init.d/apache2 restart but it may have changed.Code:# enable mod_perl <Files ~ "\.(pl|cgi)$"> SetHandler perl-script PerlResponseHandler ModPerl::Registry Options +ExecCGI PerlSendHeader On </Files>If we hit that bullseye, the rest of the dominoes will fall like a house of cards. Checkmate! (Zapp Brannigan)
My new blog. It's probably not as good as I think it is.
- 09-09-2010 #5Just Joined!
- Join Date
- Dec 2008
- Posts
- 35


Reply With Quote
