Platforms: Solaris 9, Win XP Apache: 2.0.52 Perl: ActiveState Perl 5.8.4
I'm making the first tentative steps in getting scripts running under mod_perl.
At this point i'm aiming to "encapsulate" a mod_perl script and all it's supporting images
etc., so to the client they all appear under a single "testapp" URL, where //myserver/testapp
is the application, and //myserver/testapp/images/logo.gif (for example) accesses the
relevant logo.
Under I:/WWW I have two branches, a "public" tree for general web content (shared images
etc.) and a "private" tree for application content that will only be visible through applications
or Apache-configured aliases.
Symptoms ---------- What i'm unclear on is the output line from the script-
'SCRIPT_FILENAME' => 'I:/WWW/public/testapp',
This is the publicly-visible URL of my script. Fine, but does the environment
give me any way to find the physical location of my script (i.e.
'I:/WWW/private/lib/testapp/main.pm'), or at least it's basename component?
I need this to be able to construct physical pathnames within the script to access
resource files such as HTML templates.
Regards: Colin
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Config- httpd.conf ------------------ DocumentRoot "I:/WWW/public"
<Directory "I:/WWW/public"> Options Indexes FollowSymLinks AllowOverride None Order allow,deny Allow from all </Directory>
# # testapp. # <Location /testapp> SetHandler perl-script PerlResponseHandler TestApp::Main </Location>
Alias /testapp/ "I:/WWW/private/webapp/testapp/"
<Directory "I:/WWW/private/webapp/testapp/"> Order allow,deny Allow from all </Directory>
Config- start.pl ---------------- use Apache2 (); use lib qw(I:/WWW/private/lib); 1;
TestApp ------- package TestApp::Main;
use strict; use warnings;
use Cwd; use Data::Dumper;
my $dir= cwd();
use Apache::RequestRec (); use Apache::RequestIO ();
use Apache::Const -compile => qw(OK);
sub handler {
my $r = shift; $r->content_type('text/plain');
print "Running in $dir\n";
print Dumper(\%ENV);return Apache::OK; } 1;
Output
------
Running in C:/Prog/Apache/Apache2
$VAR1 = {
'SCRIPT_NAME' => '/testapp',
'SERVER_NAME' => 'localhost',
'SystemRoot' => 'C:\\WINDOWS',
'SERVER_ADMIN' => '[EMAIL PROTECTED]',
'HTTP_ACCEPT_ENCODING' => 'gzip,deflate',
'HTTP_CONNECTION' => 'keep-alive',
'REQUEST_METHOD' => 'GET',
'HTTP_ACCEPT' =>
'application/x-shockwave-flash,text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,image/jpeg,image/gif;q=0.2,*/*;q=0.1',
'SCRIPT_FILENAME' => 'I:/WWW/public/testapp',
'COMSPEC' => 'C:\\WINDOWS\\system32\\cmd.exe',
'SERVER_SOFTWARE' => 'Apache/2.0.52 (Win32) mod_perl/1.99_17
Perl/v5.8.4',
'HTTP_ACCEPT_CHARSET' => 'ISO-8859-1,utf-8;q=0.7,*;q=0.7',
'WINDIR' => 'C:\\WINDOWS',
'QUERY_STRING' => '',
'REMOTE_PORT' => '1160',
'PATHEXT' => '.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH',
'HTTP_USER_AGENT' => 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US;
rv:1.6) Gecko/20040113',
'SERVER_PORT' => '80',
'SERVER_SIGNATURE' => '<address>Apache/2.0.52 (Win32) mod_perl/1.99_17
Perl/v5.8.4 Server at localhost Port 80</address>
',
'HTTP_CACHE_CONTROL' => 'max-age=0',
'HTTP_ACCEPT_LANGUAGE' => 'en-us,en;q=0.5',
'REMOTE_ADDR' => '127.0.0.1',
'HTTP_KEEP_ALIVE' => '300',
'SERVER_PROTOCOL' => 'HTTP/1.1',
'PATH' =>
'C:\\Prog\\Perl\\bin\\;C:\\WINDOWS\\system32;C:\\WINDOWS;C:\\WINDOWS\\System32\\Wbem;C:\\Program
Files\\ATI\\ATI Control Panel;C:\\PROGRA~1\\MICROS~2\\Office;C:\\Program
Files\\PHP;C:\\Program Files\\MySQL\\bin',
'REQUEST_URI' => '/testapp',
'GATEWAY_INTERFACE' => 'CGI/1.1',
'SERVER_ADDR' => '127.0.0.1',
'DOCUMENT_ROOT' => 'I:/WWW/public',
'HTTP_HOST' => 'localhost',
'MOD_PERL' => 'mod_perl/1.99_17'
};- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html
