Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win


Why doesn´t my perlscript work with apache

Posted on 1998-06-29
Medium Priority
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.
Question by:cl071997
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

Expert Comment

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

Expert Comment

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.

Author Comment

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.


Accepted Solution

tpryor earned 400 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.


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


Author Comment

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


Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

Email validation in proper way is  very important validation required in any web pages. This code is self explainable except that Regular Expression which I used for pattern matching. I originally published as a thread on my website : http://www…
I have been pestered over the years to produce and distribute regular data extracts, and often the request have explicitly requested the data be emailed as an Excel attachement; specifically Excel, as it appears: CSV files confuse (no Red or Green h…
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

618 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