in reply to Re: CGI as an Inline Path
in thread CGI as an Inline Path

++dws, and note that contrary to comments below, mod_rewrite or other trickery is not necessary.

It sounds like you've already figured out how to get the script itself running even though it's not in the CGI directory -- but if not, Apache's ScriptAlias or ExecCGI directives should do the job. And of course Apache respects the script's shebang line even on Windows, so you don't need to worry about having a .cgi or .pl extension or anything like that.

I couldn't tell you whether this would work with IIS, though.

Replies are listed 'Best First'.
Re: Re: Re: CGI as an Inline Path
by Kanji (Parson) on Mar 15, 2002 at 15:45 UTC
    I couldn't tell you whether this would work with IIS, though.

    IIS does have some peculiarities in it's handling of PATH_INFO that you should be aware of, but there's a knowledge base article on the subject that may be of interest.

    Update: If you use CGI.pm's path_info instead of $ENV{'PATH_INFO'}, it has a hack that'll return what you expect regardless of how IIS is configured.

    sub path_info { # .... # hack to fix broken path info in IIS $self->{'.path_info'} =~ s/^\Q$ENV{'SCRIPT_NAME'}\E// if $IIS; }

        --k.


Re: Re: Re: CGI as an Inline Path
by growlf (Pilgrim) on Mar 16, 2002 at 01:24 UTC

    Thank you - and yes, getting it to use an arbitrary CGI was an easy task without the handler code. My only issue was getting the darned query portion - which (*DOH!* thanks dws!! I really should sleep more *sigh* ) I was reminded from earlier.

    As fas as IIS goes - yes it is easy to set up a handler in it as well (just add one in 'site properties | ISAPI Filters').

    To do a simple passthrough on an Unix/Apache server I simply (as you suggested) put in a script alias for my cgi app in my appache configration file. ie

    ScriptAlias /MyCGI/ "/usr/local/www/cgi-bin/sitescript"



    *G*