CGI Perl

Anthony Gardner cyclewood_ltd at
Sun Sep 24 13:49:01 UTC 2006

For starters, I doubt this problem is really for this list. There are other mailing lists available for Perl / CGI / mod_perl queries.
 If you've installed the packages supplied in the Ubuntu distro, I might not be able to help you as I install all of mine from
 To answer some of your questions, look in the httpd.conf file to see the user. it's usualyy 'nobody' 
 To write output to your browser, in your example, you need to write sth like ...
 make sure the following exists in conf/httpd.conf
  <IfModule alias_module>
  ScriptAlias /cgi-bin/ "/usr/local/apache2/cgi-bin/"
  and make sure the following directive exists and has values set such as  ....
  <Directory "/usr/local/apache2/cgi-bin">
      SetHandler cgi-script
      AddHandler cgi-script .cgi
      AllowOverride None
      Options +ExecCGI
      Order allow,deny
      Allow from all
 Your scripts should look like ....
 use strict;
 print "Content-type: text/html\n\n";
 print "Test\n";
 and be executable ..... chmod 755 test.cgi
 If you wanna use the CGI class, try
 #!/usr/bin/perl -w
 use strict;
 use CGI;
 my $cgi = CGI->new();
 print $cgi->header();
 print 'Hello World!!';
 make it executable and run it.
 Make sure it's in your cgi-bin directory i.e. /usr/local/apache2/cgi-bin or /usr/apache2/cgi-bin
 anyway, run cgi-bin/printenv to see if things are up and running..

Emil Edeholt <emil at> wrote: Hi,

I can't get CGI Perl up and running and I don't have a clue what to do. 
Apache 2 and PHP works fine. I've uncomment AddHandler cgi-script .cgi 
and perl is installed. But I guess something more is needed?

Apache gives me an forbidden error when I try to run my example script. 
I've tried to 777 the script but I still get the error. Any ideas?

And btw under what user is apache 2 running normally in ubuntu?

My test script looks like this, and it works fine to run it from the 
terminal, so atleast perl is working:
use strict;
print "Test\n";

All ideas are welcome. Thanks!

Kind regards Emil

ubuntu-users mailing list
ubuntu-users at

 Try the all-new Yahoo! Mail . "The New Version is radically easier to use" – The Wall Street Journal
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the ubuntu-users mailing list