Running Perl in apache


I set up apache with redhat 9.0 yesterday. The probelm is when I try to run perl/cgi all it does is show me my source code. How do I fix this?


Who is Participating?
It doesn't have a 'from' section like above?

ifconfig is usually located in the /sbin directory - try:

/sbin/ifconfig eth0

(THINKING OUTLOUD) If you are using virutal hosts, you would have had to have specified an IP address to 'listen' to... that's probably part of why your cgi script isn't working properly

You need to indicate in the apache configuration files that the files that you are looking at are in fact, cgi scripts.  There a few steps for this:

1. If you have DSO (dynamic Share object) support enabled, there should be lines that look like this in the httpd.conf file:

LoadModule cgi_module         libexec/


AddModule mod_cgi.c

2.  For the directory that allows CGI scripts, you should have the ExecCGI option enabled, which will look something like:

<Directory /full/path/to/cgi/directory>
Options ExecCGI
order allow, deny
allow from all

3. Within your virtualhost statement, you should have a 'ScriptAlias' statement that looks like:

ScriptAlias /cgi-bin/ /full/path/to/cgi/directory/

(with the trailing slash).

4. You need to indicate to the server that certain file extensions need to be handled by the CGI handler with a statement like this:

AddHandler cgi-script .cgi .pl

... if you need to make any adjustments to add these items, you'll need to restart your Apache server.

PaulmulAuthor Commented:
I have done all that. This is the error I am getting

httpd failed. The error was: Starting httpd: httpd: Could not determine the server's fully qualified domain name, using for ServerName

Cloud Class® Course: Amazon Web Services - Basic

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

Do you have a ServerName statement for the virtual host?  Can you post your virtualhost section here?
PaulmulAuthor Commented:
I have added a servername since I posted that. I think the probelm is my IP address, I don't know it and in turn it is not regocnizing my machine. How do I get my IP, I was told ifconfig -a but My machine says commmand not found.

The error I am getting now is httpd failed. The error was: Starting httpd: [FAILED]

I think it has something to do with not having proper IP address.
you could simply use 'ping' to ping somewhere else, like ebay:


It will say something like:

PING ( from <youripaddress>: 56(84) bytes of data.

where <youripaddress> is your computer.
PaulmulAuthor Commented:
That doesn't give my address, just the server that I ping.
PaulmulAuthor Commented:
Ok, I found my IP address and now it all works. The problem is I've killed my internet access (Currently using windows) If you have any idea how I did that and how I can fix it I would be very greatful. Thanks for helping with the other stuff though.

PaulmulAuthor Commented:
When I wrote (currently using windows) I mean I am using windows as I killed my internet access on Linux.
I understand what you mean - you're posting from a different computer because your linux box currently cannot access the internet.

do you have a file called /etc/sysconfig/network?  In there, it should say:


as well as give the gateway address and device...

Also, look at /etc/resolv.conf - it should give the name servers that you are using to resolve external domain names.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.