Link to home
Start Free TrialLog in
Avatar of Paulmul
Paulmul

asked on

Running Perl in apache

Hi,

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?

Thanks,

Paul
Avatar of periwinkle
periwinkle
Flag of United States of America image

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/mod_cgi.so

...

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
</Directory>

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.

Avatar of Paulmul
Paulmul

ASKER

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 127.0.0.1 for ServerName
[FAILED]

Thanks
Do you have a ServerName statement for the virtual host?  Can you post your virtualhost section here?
Avatar of Paulmul

ASKER

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:

ping ebay.com

It will say something like:

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

where <youripaddress> is your computer.
Avatar of Paulmul

ASKER

That doesn't give my address, just the server that I ping.
ASKER CERTIFIED SOLUTION
Avatar of periwinkle
periwinkle
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Paulmul

ASKER

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.

Paul
Avatar of Paulmul

ASKER

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:

NETWORKING=yes

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.