Hi all,

I am a self-taught Linux admin, working hard on patching my knowledge
potholes. One of them is Apache/cgi/perl configuration.

I am using Mandrake 8.1 on an Intel machine, that comes pre-installed
with Apache 1.3.

Default configuration file (/etc/httpd/conf/commonhttpd.conf) looks as
follows (only the last part that pertains to this issue, I hope :-) ):



# This should be changed to whatever you set DocumentRoot to.
#
<Directory /var/www/html>

#
# This may also be "None", "All", or any combination of "Indexes",
# "Includes", "FollowSymLinks", "ExecCGI", or "MultiViews".
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
    Options Indexes FollowSymLinks MultiViews

#
# This controls which options the .htaccess files in directories can
# override. Can also be "All", or any combination of "Options",
"FileInfo", 
# "AuthConfig", and "Limit"
#
    AllowOverride All

#
# Controls who can get stuff from this server.
#
    Order allow,deny
    Allow from all
</Directory>

<Directory /var/www/perl>
    AllowOverride All
#    Options Indexes FollowSymLinks MultiViews ExecCGI
    Options FollowSymLinks MultiViews ExecCGI
    Order allow,deny
    Allow from all
</Directory>

<Directory /var/www/cgi-bin>
    AllowOverride All
    Options Includes ExecCGI
</Directory>

<Directory /var/www/protected-cgi-bin>
    AllowOverride None
    Options ExecCGI
    Order deny,allow
    Deny from all
    Allow from 127.0.0.1
    #allow from .your_domain.com
</Directory>

#
# Control access to UserDir directories.  The following is an example
# for a site where these directories are restricted to read-only.
#
#<Directory /home/*/public_html>
#    AllowOverride FileInfo AuthConfig Limit
#    Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
#    <Limit GET POST OPTIONS PROPFIND>
#        Order allow,deny
#        Allow from all
#    </Limit>
#    <LimitExcept GET POST OPTIONS PROPFIND>
#        Order deny,allow
#        Deny from all
#    </LimitExcept>
#</Directory>

# These settings are pretty flexible, and allow for Frontpage and XSSI
<Directory /Users/*/public_html>
    AllowOverride All
    Options MultiViews Indexes Includes FollowSymLinks
    Order allow,deny
    Allow from all
</Directory>

#<Directory /Users/*/public_html/cgi-bin>
#    AllowOverride All
#    Options ExecCGI
#    SetHandler cgi-script
#</Directory>


<IfModule mod_perl.c>
    <Directory /Users/*/public_html/cgi-bin>
        SetHandler perl-script
        PerlHandler Apache::PerlRun
        Options -Indexes ExecCGI
        PerlSendHeader On
    </Directory>
</IfModule>

<Directory /var/www/icons>
    Options Indexes MultiViews
    AllowOverride None
    Order allow,deny
    Allow from all
</Directory>

<Directory /usr/share/doc>
    Options Indexes FollowSymLinks
    Order deny,allow
    Deny from all
    Allow from 127.0.0.1
    #allow from .your_domain.com
</Directory>

<Location /index.shtml>
    Options +Includes
</Location>

<IfModule mod_perl.c>
    PerlModule Apache::Registry
    
    #set Apache::Registry Mode for /perl Alias
    <Location /perl/*.pl>
        SetHandler perl-script
        PerlHandler Apache::Registry
        Options -Indexes ExecCGI
        PerlSendHeader On
    </Location>

    #set Apache::PerlRun Mode for /cgi-perl Alias
    <Location /cgi-perl/*.pl>
        SetHandler perl-script
        PerlHandler Apache::PerlRun
        Options -Indexes ExecCGI
        PerlSendHeader On
    </Location>
</IfModule>



Now, there are several issues that I am trying to figure out:

My Cgi dirs (both the system one in /var/www/cgi-bin/ and individual
user ones in /home/~username/public_html/cgi-bin/ ) do work if I call a
cgi script directly from an url (i.e. http://foo.com/cgi-bin/bar.cgi).

The problem is when I want to use a cgi script within an html file, no
matter where I store the html file (obviously default preference being
in my user's public_html folder), the <--#exec ... --> calls, or any
other call of such type contained within an Html file, is simply
ignored.

I tried fiddling with configuration, but am lacking in-depth knowledge
of all the different settings (I do understand that I do need to have
Options and Includes in the folders where I need to be able to have html
files with embeded cgi calls -- please correct me if I am wrong). Also,
I am not quite sure what is the difference between, for instance
+Includes -Includes, and just simply Includes (my understanding from all
of the doc searching is that the first two add/subtract from the default
settings possibly stored in the folder's .htaccess, while the third one
explicitly adds this functionality?).

Searching over the net for the solution has resulted in a frustratingly
wasted weekend. So, I am hoping that someone would be kind enough to
help me figure this issue out.

Even the calls like:

<!--#echo var="DATE_LOCAL" -->
(not sure if this still falls into the mod_perl category tho)

and

<!--#exec cmd="/usr/ucb/finger $REMOTE_USER@$REMOTE_HOST"-->
(yet another copy/paste thing that I put into my html file to see if the
whole thing works at all)

do not work whatsoever.

The other issue I would greatly appreciate to have clarified is the
whole question as to how to retrieve more info regarding the dreaded 500
error when executing cgi scripts, when apache's error_log is too skimpy
with info to give anything valuable (it simply says 500 premature end of
script, which can be a ton of things), and when the script executes just
fine at the command-line (i.e. #\perl file.cgi)?

I would greatly appreciate any help I can get. Thank you very much!
Sincerely,

Ico


Reply via email to