Solved

Running Perl in apache

Posted on 2003-11-28
10
369 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
 
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
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 
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

Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Join & Write a Comment

As Wikipedia explains 'robots.txt' as -- the robot exclusion standard, also known as the Robots Exclusion Protocol or robots.txt protocol, is a convention to prevent cooperating web spiders and other web robots from accessing all or part of a websit…
Introduction As you’re probably aware the HTTP protocol offers basic / weak authentication, which in combination with the relevant configuration on your web server, provides the ability to password protect all or part of your host.  If you were not…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

760 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

Need Help in Real-Time?

Connect with top rated Experts

25 Experts available now in Live!

Get 1:1 Help Now