You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Ron Wingfield <dt...@ionet.net> on 2002/06/04 03:01:03 UTC

CGI and ScriptAlias Alternatives

RE:  the directory structure below:  I want to contain general purpose CGI scripts in sub-directories under the /www/cgi-bin/ directory.  These objects only need one common occurrence on the system.  I want these objects segregated by type with regard to Perl Scripts, C objects, unix shell scripts, Java , ad nauseam.

I'm having difficulty executing the counter.pl in the common directory.  If I add a ScriptAlias, e.g.,

  ScriptAlias /cgi-bin/   "/www/cgi-bin/perl/"

to the httpd.conf container for the VirtualHost, apples.com.


After execution of the index.htm file in the host's DocumentRoot directory, /www/vhosts/apples.com (as directed in the httpd.conf file), the error-log message contains:  "invalid CGI ref "www/cgi-bin/perl/counter.pl".  For the present, I am trying to understand the system of overrides, aliases, etc., without the added complexity of suEXEC.   I do plan to go there, but only after getting a handle on a simpler configuration.  Regardless, I am using .htaccess files in target directories, and with some success.  For example, I have a perl script, wiggle.pl, in the VirtualHost structure for apples.com which is successfully executed by the wiggle.htm, . . .as long as I do not include the previously described ScriptAlias.  From what I've read, the concept of ScriptAlias seems rather restrictive with regard to managing executables in a hierarchal directory structure.  

Can I still use default ScriptAliases to point to multiple hierarchal directory structures for executables, as in the following example, and still use local directory overrides? 


/www/
----------cgi-bin/
          ----------perl/
                    ----------counter.pl
          ----------C/
          ----------Java/
          ----------unix_shell/
----------data/
          ----------page_counters
----------htdocs/
= = = = = = = = = = = = = = = = = = = = = = = = = = = = =
----------vhosts/
          ----------apples.com/
                    ----------.htaccess
                    ----------htdocs/
                              ----------Yet_another_dir/
                                        ----------.htaccess
                                        ----------wiggle.htm
                    ----------Index.htm
                    ----------cgi-bin/
                              ----------perl/
                                        ----------wiggle.pl
                              ----------Java_Script/
          ----------oranges.com
          ----------whatever.com



Re: CGI and ScriptAlias Alternatives

Posted by Ron Wingfield <dt...@ionet.net>.
Yes, I guess I AM using SSL -- my instruction in the index.htm is:

            <!--#exec cgi="/www/cgi-bin/perl/counter.pl"-->

. . .but, I'm a neubie, and I try what I read, and I have never read anything about "direct CGI" until now.  Thanks!  I'll try some options, and let you know.

OTTF (Onward Through The Fog),
Ron W.
  ----- Original Message ----- 
  From: Joshua Slive 
  To: users@httpd.apache.org 
  Sent: Monday, June 03, 2002 9:33 PM
  Subject: Re: CGI and ScriptAlias Alternatives


  Ron Wingfield wrote:

  > I'm having difficulty executing the counter.pl in the common directory.  
  > If I add a ScriptAlias, e.g.,
  >  
  >   ScriptAlias /cgi-bin/   "/www/cgi-bin/perl/"
  >  
  > to the httpd.conf container for the VirtualHost, apples.com.
  >  
  > 
  > After execution of the index.htm file in the host's DocumentRoot 
  > directory, /www/vhosts/apples.com (as directed in the httpd.conf file), 
  > the error-log message contains:  "invalid CGI ref 
  > "www/cgi-bin/perl/counter.pl".  

  This sounds conspicuously like you are using SSI, not direct CGI.  The 
  error message is from the SSI.

  Start by requesting the cgi script directly (as in 
  http://example.com/cgi-bin/perl/counter.pl) and make sure that works.

  Once that works, then try to get it to work in SSI.  Forget about "#exec 
  cgi".  You should never use that.  Instead, use <!--#include 
  virtual="/cgi-bin/perl/counter.pl" -->.

  Joshua.


  ---------------------------------------------------------------------
  To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
  For additional commands, e-mail: users-help@httpd.apache.org


Re: CGI and ScriptAlias Alternatives

Posted by Ron Wingfield <dt...@ionet.net>.
Well, I've tried some things.  My question, now, is regarding the syntax of a call to the global perl script.  Keep in mind that the counters.pl script that I'm trying to execute is outside, or on top of the VirtualHost's DocumentRoot (refer back to my original directory structure).  So, if you're sitting there, positioned, viewing the /www/vhosts/apples.com/index.htm page, . . .having expected this page to have received the output of a perl script, located above in the /www/cgi-bin/perl/counters.pl, . . .then how (for test purposes) would you specify it (the perl script) as an address typed into the address line of MS/Explorer, NetScape, etc.?   Again, keep in mind that this script is in a directory above the DocumentRoot of the VirtualHost.  In other words, in my example, the counters.pl script is in the /www/cgi-bin/perl directory of my primary server's DocumentRoot.  Apples.com is a VirtualHost.

Also, isn't the "#include virtual" instruction designed to dynamically copy html code into a parent html document, at execution time, resulting in a virtually expanded html document.  I guess I'm puzzled as to how merging-in  perl-script is going to cooperate with the html.  I'm just an old programmer, but I am still inclined to want to execute something. . ., regardless, if there is a better way. . .  Does the "include virtual" path leading to an executable, cause Apache to automagically execute the (perl) script?
  ----- Original Message ----- 
  From: Joshua Slive 
  To: users@httpd.apache.org 
  Sent: Monday, June 03, 2002 9:33 PM
  Subject: Re: CGI and ScriptAlias Alternatives


  Ron Wingfield wrote:

  > I'm having difficulty executing the counter.pl in the common directory.  
  > If I add a ScriptAlias, e.g.,
  >  
  >   ScriptAlias /cgi-bin/   "/www/cgi-bin/perl/"
  >  
  > to the httpd.conf container for the VirtualHost, apples.com.
  >  
  > 
  > After execution of the index.htm file in the host's DocumentRoot 
  > directory, /www/vhosts/apples.com (as directed in the httpd.conf file), 
  > the error-log message contains:  "invalid CGI ref 
  > "www/cgi-bin/perl/counter.pl".  

  This sounds conspicuously like you are using SSI, not direct CGI.  The 
  error message is from the SSI.

  Start by requesting the cgi script directly (as in 
  http://example.com/cgi-bin/perl/counter.pl) and make sure that works.

  Once that works, then try to get it to work in SSI.  Forget about "#exec 
  cgi".  You should never use that.  Instead, use <!--#include 
  virtual="/cgi-bin/perl/counter.pl" -->.

  Joshua.


  ---------------------------------------------------------------------
  To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
  For additional commands, e-mail: users-help@httpd.apache.org


Re: CGI and ScriptAlias Alternatives

Posted by Joshua Slive <jo...@slive.ca>.
Ron Wingfield wrote:

> I'm having difficulty executing the counter.pl in the common directory.  
> If I add a ScriptAlias, e.g.,
>  
>   ScriptAlias /cgi-bin/   "/www/cgi-bin/perl/"
>  
> to the httpd.conf container for the VirtualHost, apples.com.
>  
> 
> After execution of the index.htm file in the host's DocumentRoot 
> directory, /www/vhosts/apples.com (as directed in the httpd.conf file), 
> the error-log message contains:  "invalid CGI ref 
> "www/cgi-bin/perl/counter.pl".  

This sounds conspicuously like you are using SSI, not direct CGI.  The 
error message is from the SSI.

Start by requesting the cgi script directly (as in 
http://example.com/cgi-bin/perl/counter.pl) and make sure that works.

Once that works, then try to get it to work in SSI.  Forget about "#exec 
cgi".  You should never use that.  Instead, use <!--#include 
virtual="/cgi-bin/perl/counter.pl" -->.

Joshua.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org