Steve Revilak wrote:
> In the java world, you have Sun's servlet specification, that
> describes how a web application interacts with the servlet container
> that runs it.
>
> http://jcp.org/aboutJava/communityprocess/final/jsr154/index.html
>
> While it's not apache/cgi, some of the general ideas could be applied
> to a cgi-app.
Thanks for the pointer. We seem to be borrowing from Java a lot these days.
> In the apache world, this isn't much different than
>
> Alias "/myapp/" /path/to/myapp/public_html/
> <Directory "/path/to/myapp/public_html/">
> Allow from all
> Options +ExecCGI
> # other options as necessary
> </Directory>
Technically you need an AddType directive in there as well if you're not
making any assumptions about the existing config.
Your approach also assumes the CGI code and the static files live in the
same directory (or have a common, web-accessible root). That works for
me, but I can see some admins objecting to that.
The basic question, though, remains. Although there are a bunch of ways
to pull this off, what I'm trying to determine is which is the least
intrusive to the admin and what are admins expecting to see these days.
Is an admin more likely to tolerate modifying httpd.conf in order to get
a cleaner application install, or are they more apt to prefer the
application files getting scattered around if it means they can avoid
changing httpd.conf?
The last few web apps I installed came out of Debian packages, and the
package's installer picked the app. location, and modified httpd.conf.
My app. won't be so narrowly targeted and will need to offer greater
flexibility to the admin.
> If you need access to
> other libraries, define PERL5LIB in the apache configuration, or do
> something like this at the beginning of your CGI scripts
>
> BEGIN {
> use File::Basename;
> use File::Spec;
> my $webroot = File::Basename::dirname($ENV{'SCRIPT_FILENAME'});
> my $approot = File::Basename::dirname($webroot);
> my $libdir = File::Spec->catdir($approot, "lib");
> unshift(@INC, $libdir);
> }
I've done this kind of thing in the past for non-CGI scripts, but for
CGI scripts you don't need to go to that much effort if the CGI script
is located in a known location relative to where the libraries are. You
can simply use a relative path, such as:
use lib '../lib';
as it seems to be a universally adhered to convention for web servers to
change the working directory to the directory containing the CGI script
before executing it.
If you don't know where 'lib' is relative to your CGI script, then
you're stuck with needing an embedded absolute path or a config file
that is in a relative location.
-Tom
_______________________________________________
Boston-pm mailing list
[email protected]
http://mail.pm.org/mailman/listinfo/boston-pm