httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jeff White" <>
Subject Re: [users@httpd] CGI problem
Date Sat, 14 Feb 2004 15:29:48 GMT

From: "Nick Kew"

> On Sat, 14 Feb 2004, David Weaver wrote:
> > To make a long story short, I don't like having to put the
> > line at the top of every script (since it makes my scripts very
un-portable to
> > other servers),
> Erm, how does it do that?  The shebang line is a shell thing that
> back to the 1970s, and nothing to do with the webserver.

It is a design issue (good or bad?) with Apache web server.

Apache hard codes the comment marker # with ! as the check
for cgi scripts.

One can binary or source code change #! with
other language comment markers:

'*  for VBScript as the Apache cgi standard
// for JScript (EmcaScript) as the Apache standard.
whatever your new standard will be!

If on Windows check the Apache "auto" run ways,
by using the Windows file assocation run command
in Windows.

type assoc .mth in a command prompt window.

C:\Documents and Settings\User>assoc .mth
File association not found for extension .mth

type assoc /?
type ftype /?

But to test your script engine with the "#!"
standard Apache CGI setup, just type:

a one line file and save as
in the regular cgi-bin dir:

#!drive:\fullPath\yourScriptEngine.exe c:\fullPath\to\filename.mth

Yes the above is a one line file.

If the path has spaces, use the 8.3 way or quote
the "drive:\path\filename.mth" part of the above 
one line cgi test file.

In Apache, the above works like this:

Apache reads the first line of
in the cgi-bin folder.

if the first two characters are not #!
   error out with "No #! found"
  throw way the #! and load what ever
  comes after #! until a space character.
  Apache loads yourScriptEngine.exe and
  passes everything after the space, after
  the engine's path, as arguments to your
  new script engine.

So Apache loads:

yourScriptEngine.exe and as arguments for
your engine, the pathToYourScript and also
the full drive:\ApacheFullPath\cgi-bin\

Yes two arguments for your script engine!

All as one long line of arguments to your
script engine.


The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:> for more info.
To unsubscribe, e-mail:
   "   from the digest:
For additional commands, e-mail:

View raw message