Solved

cgi-bin directory doesn't work

Posted on 2001-06-13
9
214 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
Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

 
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

Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

Question has a verified solution.

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

This article covers the basics of the Sass, which is a CSS extension language. You will learn about variables, mixins, and nesting.
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.
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…
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

770 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