Solved

cgi-bin directory doesn't work

Posted on 2001-06-13
9
215 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
Easy, flexible multimedia distribution & control

Coming soon!  Ideal for large-scale A/V applications, ATEN's VM3200 Modular Matrix Switch is an all-in-one solution that simplifies video wall integration. Easily customize display layouts to see what you want, how you want it in 4k.

 
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
 
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

Easy, flexible multimedia distribution & control

Coming soon!  Ideal for large-scale A/V applications, ATEN's VM3200 Modular Matrix Switch is an all-in-one solution that simplifies video wall integration. Easily customize display layouts to see what you want, how you want it in 4k.

Question has a verified solution.

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

Suggested Solutions

Preface This article introduces an authentication and authorization system for a website.  It is understood by the author and the project contributors that there is no such thing as a "one size fits all" system.  That being said, there is a certa…
Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL (http://www.experts-exchange.com/articles/201/Handling-Date-and-Time-in-PHP-and-MySQL.html) several years ago, it seemed like now was a good time to updat…
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

856 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