Solved

cgi-bin directory doesn't work

Posted on 2001-06-13
9
211 Views
Last Modified: 2013-11-18
I'm running RH Linux 7.0 with Apache web server.  When I try to run a .pl file or a .cgi file from cgi-bin, it (MSIE) prompts me to 'open file' or 'download file'.  I've never had this problem before with any other versions of Linux.  I already did a chmod 755 on the cgi-bin directory and all the files in it.  It still won't execute the files.  I'm running Linux 7.0 and it recommends that I don't modify the /etc/httpd/conf/access.conf file.  Only the /etc/httpd/conf/httpd.conf file.  What do I modify to allow execution of the files from a browser?  There IS a ExecCGI option in httpd.conf for <Directory /var/www/cgi-bin>.  HELP!
0
Comment
Question by:GorGor2
  • 4
  • 2
  • 2
  • +1
9 Comments
 

Author Comment

by:GorGor2
ID: 6189494
oops, I'm running RHLinux7.1, not 7.0.  Not that it really matters.
0
 
LVL 8

Accepted Solution

by:
bebonham earned 50 total points
ID: 6193199
http://httpd.apache.org/docs/mod/mod_alias.html#scriptalias


if you want to put cgi in another directory other than the main scriptAlias

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.

Make sure that the directory location is covered by an Options declaration that includes the ExecCGI option.

In some situations, you might not want to actually allow all files named "*.cgi" to be executable. Perhaps all you want is to enable a particular file in a normal directory to be executable. This can be alternatively accomplished via mod_rewrite and the following steps:


Locally add to the corresponding .htaccess file a ruleset similar to this one:

RewriteEngine on
RewriteBase /~foo/bar/
RewriteRule ^quux\.cgi$ - [T=application/x-httpd-cgi]

Make sure that the directory location is covered by an Options declaration that includes the ExecCGI and FollowSymLinks option.


Bob
0
 

Author Comment

by:GorGor2
ID: 6193210
hmmm...the cgi-bin directory I'm trying to execute from IS the default cgi-bin directory that apache uses though....any ideas?
0
 
LVL 8

Expert Comment

by:bebonham
ID: 6193346
sorry, I sure don't know apache...

I think the key is to set the directory as a ScriptAlias...

have you done that?

if so, I will quitely exit this question :)
0
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
LVL 6

Expert Comment

by:christopher sagayam
ID: 6193579
where is your cgi-bin located ? I mean the full path ..
0
 

Author Comment

by:GorGor2
ID: 6193619
/var/www/cgi-bin/ is the full path

I have entries for 'Alias' 'ScriptAlias' 'Directory' 'AddHandler cgi-script .cgi' and everything in httpd.conf.  Everything appears to be ok, but it still doesn't work!
0
 
LVL 17

Expert Comment

by:psimation
ID: 6196295
I think you need to have a .htaccess file containing the following in your root folder for that web as well

Allow override All
Options ExecCGI Includes

NB, file must be called .htaccess ( note the .)
0
 

Author Comment

by:GorGor2
ID: 6196736
The really strange thing is that in Netscape, there is no prompt.  Only in MSIE.  It never did this before with any other installation of Linux and Apache.
0
 
LVL 17

Expert Comment

by:psimation
ID: 6197196
If it's virtual domains, you MUST have a <Directory> directive inside the <VirtualHost> section for the domain stating the Options ExecCGI etc...
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Suggested Solutions

Preface This is the third article about the EE Collaborative Login Project. A Better Website Login System (http://www.experts-exchange.com/A_2902.html) introduces the Login System and shows how to implement a login page. The EE Collaborative Logi…
Shoutout to Emily Plummer (http://www.experts-exchange.com/members/eplummer26.html) for giving me this article! She did most of it, I just finished it up and posted it for her :)    Introduction In a previous article (http://www.experts-exchang…
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

762 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

19 Experts available now in Live!

Get 1:1 Help Now