sodabrew / mod_perlite

A lightweight Apache module for Perl scripts
http://modperlite.org/
86 stars 7 forks source link

$ENV not effected by mod_env #5

Open byrnereese opened 14 years ago

byrnereese commented 14 years ago

I am trying to get Movable Type running under mod_perlite. The mt.pl script looks like this:

use strict;
use lib $ENV{MT_HOME} ? "$ENV{MT_HOME}/lib" : 'lib';
use MT::Bootstrap App => 'MT::App::CMS';

As you can see it would ideally reference an environment variable MT_HOME in order to build out the requisite search paths. Naturally I turn to mod_env's setenv directive:

SetEnv directive Syntax: SetEnv env-variable value Context: server config, virtual host, directory, .htaccess Override: FileInfo Status: Base Module: mod_env Compatibility: SetEnv is only available in Apache 1.1 and later. Directory and .htaccess context is available in Apache 1.3.7 and later. Sets an environment variable, which is then passed on to CGI scripts and SSI pages. Example:

SetEnv SPECIAL_PATH /foo/bin

Running this script through mod_perlite:

#!/usr/bin/perl
print "Content-type: text/plain\n\n";
foreach (keys %ENV) {
    print "$_ => $ENV{$_}\n";
}

Reveals that the MT_HOME env varibable is not getting set:

SCRIPT_NAME => /index.pl
SERVER_NAME => 72.47.209.76
SERVER_ADMIN => root@localhost
HTTP_ACCEPT_ENCODING => gzip,deflate,sdch
HTTP_CONNECTION => keep-alive
REQUEST_METHOD => GET
HTTP_ACCEPT => application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
SCRIPT_FILENAME => /var/www/vhosts/testing.majordojo.com/httpdocs/index.pl
SERVER_SOFTWARE => Apache/2.2.3 (CentOS)
HTTP_ACCEPT_CHARSET => ISO-8859-1,utf-8;q=0.7,*;q=0.3
QUERY_STRING => 
REMOTE_PORT => 4597
HTTP_USER_AGENT => Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_2; en-US) AppleWebKit/532.5 (KHTML, like Gecko) Chrome/4.0.249.30 Safari/532.5
SERVER_PORT => 80
SERVER_SIGNATURE => <address>Apache/2.2.3 (CentOS) Server at 72.47.209.76 Port 80</address>

HTTP_CACHE_CONTROL => max-age=0
HTTP_COOKIE => vzcpSession=2ebc4b5150cfte2379b2; vzcpTicket=2ebc4b5150cfte2379b2; psaContext=server; phpMyAdmin=c4Vw7IajEAZ1sb0BMArOb2T2R95
HTTP_ACCEPT_LANGUAGE => en-US,en;q=0.8
REMOTE_ADDR => 63.193.114.118
SERVER_PROTOCOL => HTTP/1.1
MOD_PERL_API_VERSION => 2
PATH => /sbin:/usr/sbin:/bin:/usr/bin
REQUEST_URI => /index.pl
GATEWAY_INTERFACE => CGI/1.1
SERVER_ADDR => 72.47.209.76
DOCUMENT_ROOT => /var/www/vhosts/testing.majordojo.com/httpdocs
HTTP_HOST => 72.47.209.76
MOD_PERL => mod_perl/2.0.4

Can we get mod_perlite to seed %ENV with variables set by SetEnv, or is that not possible?