Solved

cgi-bin directory doesn't work

Posted on 2001-06-13
9
216 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
[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
  • 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
Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

 
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

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

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

If you are a web developer, you would be aware of the <iframe> tag in HTML. The <iframe> stands for inline frame and is used to embed another document within the current HTML document. The embedded document could be even another website.
JavaScript has plenty of pieces of code people often just copy/paste from somewhere but never quite fully understand. Self-Executing functions are just one good example that I'll try to demystify here.
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…
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…

740 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