You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by "TD - Sales International Holland B.V." <td...@salesint.com> on 2002/01/28 11:24:41 UTC

Re: CGI-BIN & Perl scripts -=- DOC MAINTAINERS PLEASE LOOK INTO THIS!

On Friday 25 January 2002 16:08, you wrote:

Hmm, I was under the assumption mod_alias would be enough.

>From the mod_alias documentation page:

<docs>
ScriptAlias directive

Syntax: ScriptAlias URL-path file-path|directory-path
Context: server config, virtual host
Status: Base
Module: mod_alias

The ScriptAlias directive has the same behavior as the Alias directive, 
except that in addition it marks the target directory as containing CGI 
scripts. URLs with a (%-decoded) path beginning with URL-path will be mapped 
to scripts beginning with the second argument which is a full pathname in the 
local filesystem.

Example:
ScriptAlias /cgi-bin/ /web/cgi-bin/

A request for http://myserver/cgi-bin/foo would cause the server to run the 
script /web/cgi-bin/foo.
</docs>

There isn't anything mentioned about mod_cgi in here. If it relies on that it 
might be something that needs to be added to the docs, it sure would help :-)

Appearantly you're right, this comes from the mod_cgi docs:

<docs>
	This module provides for execution of CGI scripts.

Status: Base
Source File: mod_cgi.c
Module Identifier: cgi_module
Summary

Any file that has the mime type application/x-httpd-cgi or handler cgi-script 
(Apache 1.1 or later) will be treated as a CGI script, and run by the server, 
with its output being returned to the client. Files acquire this type either 
by having a name containing an extension defined by the AddType directive, or 
by being in a ScriptAlias directory.

When the server invokes a CGI script, it will add a variable called 
DOCUMENT_ROOT to the environment. This variable will contain the value of the 
DocumentRoot configuration variable.

For an introduction to using CGI scripts with Apache, see our tutorial on 
Dynamic Content With CGI.

When using a multi-threaded MPM under unix, the module mod_cgid should be 
used in place of this module. At the user level, the two modules are 
essentially identical.

</docs>

As it says, it gets marked by the ScriptAlias or the AddType (mime type) 
directives. If there had been a little line in the mod_alias doc that it 
relied on this I could have saved you and myself a lot of time. I kinda miss 
this on more modules in the documentation. 

Kind regards and thanks for the help.

> I don't see mod_cgi as being enabled. I think you need it.
>
> -Andy
>
> On Fri, 25 Jan 2002 14:30:34 +0100
>
> "TD - Sales International Holland B.V." <td...@salesint.com> wrote:
> > On Friday 25 January 2002 13:34, you wrote:
> >
> > thanks :-) but I made that mistake typing it into my email editor, they
>
> are
>
> > in the file. I know it's correct since if I run (on the command prompt)
> > ./test.pl I get:
> > Content-Type: text/html
> >
> > <HTML><BODY>bla bla</BODY></HTML>
> >
> > any ideas?
> > +ExecCGI didn't help either. Perhaps I need something like AddHandler,
>
> but
>
> > I'm not too sure about that. I configured it from scratch this time but
>
> on
>
> > some of my other puters with a default apache install (from distro) it
> > doesn't matter which extension I give my files as long as I chmod +x em.
> >
> > Besides, if I'm not mistaken, if I use AddHandler I'll be in trouble
>
> because
>
> > the .pl files will then be executed wherever they are right? Not just in
>
> the
>
> > cgi-bin dir, which is what I want. Doing this from scratch so I have a
>
> better
>
> > understanding of the server and it's security implications.
> >
> > I disabled some modules perhaps that's it but I don't think so.
> > These are the enabled!! modules:
> >
> > env
> > log_config
> > mime
> > negotiation
> > status
> > autoindex
> > dir
> > alias
> > access
> > auth
> > so
> > php4 (DSO)
> > ssl (compiled in, not DSO thus)
> >
> > disabled modules:
> >
> > include
> > asis
> > imap
> > actions
> > rewrite (DSO)
> >
> > All other modules are NOT compiled. I disabled the above ones because I
>
> have
>
> > no need for them.
> >
> > Kind regards
> >
> > > Your missing a quote & a semicolon. It should be
> > >
> > > #!/usr/bin/perl
> > > print "Content-type: text/html\n\n";
> > > print "<HTML><BODY>bla bla</BODY></HTML>";
> > >
> > >
> > > -=- RuneImp
> > > ImpTech - Web Design, Hosting & Computer Tech
> > > http://imptech.net
> > > rune@imptech.net
> > >
> > >
> > > ----- Original Message -----
> > > From: "TD - Sales International Holland B.V." <td...@salesint.com>
> > > To: <us...@httpd.apache.org>
> > > Sent: Friday, January 25, 2002 4:21 AM
> > > Subject: CGI-BIN & Perl scripts
> > >
> > >
> > > Hey there,
> > >
> > > I made a simple perl script like this:
> > > #!/usr/bin/perl
> > > print "Content-type: text/html\n\n";
> > > print "<HTML><BODY>bla bla</BODY></HTML>
> > >
> > > file is name test.pl, permissions
> > > -rwxr-xr-x root, root, other
> > > ./test.pl works as expected
> > > in httpd.conf:
> > > ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"
> > >
> > > <Directory "/var/www/cgi-bin">
> > >   AllowOverride None
> > >   Options None
> > >   Order Allow,Deny
> > >   Allow from all
> > > </Directory>
> > >
> > > when going to
> > > http://myserver/cgi-bin/test.pl
> > > I just get the contents of the file, also html files can be served
>
> from the
>
> > > directory (although it doesn't recognize index files
> > > (myserver.tld/cgi-bin/index.html will show the index file but
> > > myserver.tld/cgi-bin/ will give no such file or directory). I was
>
> under the
>
> > > assumption anything in a scriptalias directory would be executed but
>
> it
>
> > > doesn't look like it....
> > >
> > > Any ideas?
> > >
> > > Kind regards
> > >
> > > ---------------------------------------------------------------------
> > > The official User-To-User support forum of the Apache HTTP Server
>
> Project.
>
> > > See <URL:http://httpd.apache.org/userslist.html> for more info.
> > > To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> > > For additional commands, e-mail: users-help@httpd.apache.org
> > >
> > >
> > >
> > >
> > > ---------------------------------------------------------------------
> > > The official User-To-User support forum of the Apache HTTP Server
>
> Project.
>
> > > See <URL:http://httpd.apache.org/userslist.html> for more info.
> > > To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> > > For additional commands, e-mail: users-help@httpd.apache.org
> >
> > ---------------------------------------------------------------------
> > The official User-To-User support forum of the Apache HTTP Server
>
> Project.
>
> > See <URL:http://httpd.apache.org/userslist.html> for more info.
> > To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> > For additional commands, e-mail: users-help@httpd.apache.org
>
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: CGI-BIN & Perl scripts -=- DOC MAINTAINERS PLEASE LOOK INTO THIS!

Posted by "TD - Sales International Holland B.V." <td...@salesint.com>.
On Tuesday 29 January 2002 16:51, you wrote:

Thanks :-) That would be welcome. For each module I have disabled I have 
looked at it's page and read what it does. Anything I don't need I disabled. 
In regard to your comment, like I stated in a previous email, for some reason 
mod_cgi and mod_setenvif (there's a setenvif directive for the mod_ssl so I 
need that) did NOT show up in the config file generated by apache. Why this 
happened I don't know. I'll gladly tell you how I compiled apache 1.3.22 if 
you'd like to know, I still have the configure line here. The modules did 
show up when doing httpd -l. My guess is that the mod_ssl installation's 
modifications to the apache source tree made these modules disappear.... 
Server works like a charm now though :-) Thinking of disabling CGI 
altogether, we're not gonna use it anyway, we use PHP for all the dynamic 
content.....

Anyways, thanks for adding it to the docs :-)

Have a good one

> > From: TD - Sales International Holland B.V. [mailto:td@salesint.com]
> >
> > Hmm, I was under the assumption mod_alias would be enough.
>
> My recommendation would be not to disable standard modules unless you know
> what you are doing.
>
> But I have just added a reference to mod_cgi in the ScriptAlias docs.
>
> Joshua.
>
>
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


RE: CGI-BIN & Perl scripts -=- DOC MAINTAINERS PLEASE LOOK INTO THIS!

Posted by Joshua Slive <jo...@slive.ca>.
> From: TD - Sales International Holland B.V. [mailto:td@salesint.com]

> Hmm, I was under the assumption mod_alias would be enough.

My recommendation would be not to disable standard modules unless you know
what you are doing.

But I have just added a reference to mod_cgi in the ScriptAlias docs.

Joshua.


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org