Solved

Running Perl in apache

Posted on 2003-11-28
10
371 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
Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

 
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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

Suggested Solutions

If your site has a few sections that need to be secure when data is transmitted between the server and local computer, such as a /order/ section for ordering or /customer/ which contains customer data, etc it would of course be recommended to secure…
It is possible to boost certain documents at query time in Solr. Query time boosting can be a powerful resource for finding the most relevant and "best" content. Of course the more information you index, the more fields you will be able to use for y…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

770 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