[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[cobalt-users] Re: Enable CGI



>  On my Raq3i when I choose NOT to enable CGI with the GUI on a site, pl and
> cgi scripts can still be executed
> Has anyone else come across this and have a  reason as to why it does not
> work?
> I have made NO manual changes to any of the conf or system files.
> It seemed to happen after I installed the last cobalt update for the Raq3.

I haven't had direct experience with this problem *because* I don't
use the GUI (nudge nudge). My guess is that what the GUI is doing is
enable/disabling the "cgiwrap" software, which does NOT affect using
cgi's -- it only affects whether your system uses "CGIWrap" to run them.
CGIWrap is a program that sets the uid of the script being run to the
UID of the person who owns the script. Without cgiwrap, scripts are
run under the uid "httpd".  To turn off CGI *completely*, you
have to step away from the GUI interface and hand-edit the config
files in /etc/httpd/conf/. Unfortunately, RTFM is the best advice.

> Also if I execute a cgi script without first disabling CGI Wrap by using a
> htaccess file I get the actual text of the script rather than running the

that's because the file is no longer interpreted as an executable
file -- now it's just a plain old text file that it'll happily serve
to the user, like any other text file.  Note that your method
of disabling cgi using the htaccess file sounds like a good solution
for you.

>   I am sure the two problems are related,

I don't think they're related -- it just looks that way.

Here's a CGI script you can install in your CGI directory, and it'll
tell you what your current CGI environment is like. I named mine GetCGIEnv
and you can run it using http://www.danheller.com/cgi/GetCGIEnv

#! /usr/bin/perl -w

package GetCGIEnv;
use strict;

use CGI qw(:standard);

my $table_data;

my $q = CGI->new();

foreach my $i (sort keys(%ENV)) {
    $table_data .= $q->Tr($q->td($i), $q->td($ENV{$i}));
}

print($q->header,
      $q->start_html(-Title=>'CGI Environment', -bgcolor=>'white'),
      $q->h1('CGI Environment'),
      $q->blockquote($q->table($table_data)),
      $q->end_html);