Solved

Why doesn´t my perlscript work with apache

Posted on 1998-06-29
5
212 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

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

Many time we need to work with multiple files all together. If its windows system then we can use some GUI based editor to accomplish our task. But what if you are on putty or have only CLI(Command Line Interface) as an option to  edit your files. I…
There are many situations when we need to display the data in sorted order. For example: Student details by name or by rank or by total marks etc. If you are working on data driven based projects then you will use sorting techniques very frequently.…
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…
Six Sigma Control Plans

707 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