Solved

Why doesn´t my perlscript work with apache

Posted on 1998-06-29
5
180 Views
Last Modified: 2010-03-04
I think this is a very basic config-question.
I´m using Apache 1.3 and I want to run a simple perlscript.
I have Options ExecCGI in "access.conf" and the script has 755 rights. When I tries to execute the script I just get the sourcecode.
0
Comment
Question by:cl071997
  • 2
  • 2
5 Comments
 
LVL 2

Expert Comment

by:tpryor
ID: 1208236
make sure the suffix is recognized as a cgi example .cgi or .pl
0
 

Expert Comment

by:scrytch
ID: 1208237
Is the script in a ScriptAlias dir or end with the proper extension? (usually .cgi, set from AddHandler cgi-script .cgi)
Those should be sitting in srm.conf, and are commented out by default.
0
 

Author Comment

by:cl071997
ID: 1208238
ScriptAlias was commented out, but now it´s not, but still it don´t work. (I have rebooted). The perlscript has the extension .cgi. It´s a very simple script taken from a book, so we can sxclude the script (I think). As I said - I get the whole sourcecode instead of a executed script.

/Claes
Sweden
0
 
LVL 2

Accepted Solution

by:
tpryor earned 100 total points
ID: 1208239
I wasnt referring to the script.  Im referring to the config.
you must specify what suffix is to be executed in the config files.

Well if it is in the script alias directory it doesnt matter what the extension is.

Eamples:

1) ScriptAlias:

The ScriptAlias directive has the same behavior as the Alias directive, except that in addition it marks the target directory as containing CGI scripts. URLs with a (%-decoded) path beginning with url-path will be mapped to scripts beginning with directory-filename. Example:
ScriptAlias /cgi-bin/ /web/cgi-bin/A request for
http://myserver/cgi-bin/foo would cause the server to run the script /web/cgi-bin/foo.

2) Extensions, .cgi .pl etc
How do I enable CGI execution in directories other than the ScriptAlias?
  Apache recognizes all files in a directory named as a ScriptAlias as being eligible for execution rather than processing as normal documents. This applies regardless of the file name, so scripts in a ScriptAlias directory don't need to be named "*.cgi" or "*.pl" or whatever. In other words, all files in a ScriptAlias directory are scripts, as far as Apache is concerned. To persuade Apache to execute scripts in other
locations, such as in directories where normal documents may also live, you must tell it how to recognize them - and also that it's okay to execute them. For this, you need to use something like the AddHandler directive. In an appropriate section of your server configuration files, add a line such as AddHandler cgi-script .cgi The server will then recognize that all files in that location (and its logical descendants) that end in ".cgi" are script files, not documents.

##########################################################

Check out "http://www.apache.org/docs/misc/FAQ.html"
for more info

GL
t
0
 

Author Comment

by:cl071997
ID: 1208240
Thank you. I noticed that I made misstake when I commented out the lines about ScriptAlias. Another # was removed to in front of an ordinary textline, so the web server didn´t start. I accessed the htnml file by "open file" and tried to execute the script that way.
Well, now it works.

Thanks again

/claes
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

I've just discovered very important differences between Windows an Unix formats in Perl,at least 5.xx.. MOST IMPORTANT: Use Unix file format while saving Your script. otherwise it will have ^M s or smth likely weird in the EOL, Then DO NOT use m…
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

911 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

20 Experts available now in Live!

Get 1:1 Help Now