Solved

Running Perl in apache

Posted on 2003-11-28
10
372 Views
Last Modified: 2010-03-04
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
0
Comment
Question by:Paulmul
  • 5
  • 5
10 Comments
 
LVL 15

Expert Comment

by:periwinkle
ID: 9846823
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.

0
 
LVL 1

Author Comment

by:Paulmul
ID: 9857513
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
0
 
LVL 15

Expert Comment

by:periwinkle
ID: 9857836
Do you have a ServerName statement for the virtual host?  Can you post your virtualhost section here?
0
Easy, flexible multimedia distribution & control

Coming soon!  Ideal for large-scale A/V applications, ATEN's VM3200 Modular Matrix Switch is an all-in-one solution that simplifies video wall integration. Easily customize display layouts to see what you want, how you want it in 4k.

 
LVL 1

Author Comment

by:Paulmul
ID: 9857992
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.
0
 
LVL 15

Expert Comment

by:periwinkle
ID: 9858130
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.
0
 
LVL 1

Author Comment

by:Paulmul
ID: 9858193
That doesn't give my address, just the server that I ping.
0
 
LVL 15

Accepted Solution

by:
periwinkle earned 50 total points
ID: 9858376
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

0
 
LVL 1

Author Comment

by:Paulmul
ID: 9860172
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
0
 
LVL 1

Author Comment

by:Paulmul
ID: 9860350
When I wrote (currently using windows) I mean I am using windows as I killed my internet access on Linux.
0
 
LVL 15

Expert Comment

by:periwinkle
ID: 9860559
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.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
IBM HTTP Server Log rotation 5 172
ports for sccm 2012 1 88
New OSQA server has a ton of fake users 4 71
development site is indexed by google even though behind htpasswd 7 70
Over the last year I have answered a couple of basic URL rewriting questions several times so I thought I might as well have a stab at: explaining the basics, providing a few useful links and consolidating some of the most common queries into a sing…
If you've heard about htaccess and it sounds like it does what you want, but you're not sure how it works... well, you're in the right place. Read on. Some Basics #1. It's a file and its filename is .htaccess (yes, with a dot in the front). #…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

820 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question