Skip to content
This repository
tag: REL_5_5_3
Fetching contributors…

Cannot retrieve contributors at this time

file 161 lines (90 sloc) 3.161 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161
#!/usr/bin/perl
##!~_~perlpath~_~


=head1 NAME

ic_mod_perl -- Run Interchange entirely inside Apache/mod_perl


=head1 SYNOPSIS

# Add to Apache httpd.conf:
PerlRequire /usr/lib/interchange/bin/ic_mod_perl
PerlChildInitHandler Vend::ModPerl::child_start
PerlChildExitHandler Vend::ModPerl::child_end
<Location /ic>
SetHandler perl-script
PerlHandler Vend::ModPerl
PerlSendHeader Off
PerlSetupEnv On
</Location>


=head1 DESCRIPTION


=head2 Benefits

=item *

Possibly better stability, especially on non-Linux platforms where
Perl signals are often buggy.

=item *

Use less memory total; don't have preforked Apache I<and> Interchange
daemons. Adds about 8 MB more to a typical Apache/mod_perl child process,
for a total of, say, 32 MB per Apache child process. But standalone
Interchange usually has 3 processes: an Interchange child process (~24
MB), an httpd child (~24 MB), I<and> a link CGI (~1 MB), so it's
actually a decent savings in total memory used.

=item *

Speed (ranging from slightly faster to the same on heavy pages,
to 10 hits/sec. faster on empty pages).

=item *

Debugging -- delve into bowels with Apache::Status.

=item *

Easier coexistence with other mod_perl code and libraries.

=item *

Can coexist with standalone Interchange codebase without problems.

=item *

Administrative ease (for sysadmins who know Apache but not Interchange).


=head2 Drawbacks

=item *

Interchange runs as web server user, which in a standard system is usually
apache or www, so you wouldn't want to share that Apache installation
with untrusted user CGIs, PHP, etc. as they could read any Interchange
files, including DSNs, userdb, etc.

=item *

Apache needs to be dedicated, or very closely watched because all
mod_perl stuff runs in the same interpreter, and lots of mod_perl code
doesn't use Safe.

=item *

How do you scale to multiple app servers in this configuration?

=over 4

=item *

Hardware or software port redirector

=item *

Tux CGI front-end redirector like tlink

=item *

Separate lightweight Apache (no modules) that proxies /ic requests

=back


=head2 Ideal system setup

Use Tux to serve images & static content, and a dedicated Apache for
Interchange running under the 'interch' user and with no UserDir, CGI,
PHP, etc. enabled and an empty DocRoot.


=head1 CAVEATS

=item *

Watch out for differing Storable versions in sessions when switching
between standalone and mod_perl runs!


=head1 BUGS

=item *

Haven't yet implemented form/multipart submissions.

=item *

Don't yet handle TolerateGet.

=item *

Don't yet handle MiniVend 3 style GETs (mv_session_id;mv_arg;mv_pc)

=item *

URIs must follow format C</ic/catalogname/page...>, where /ic is
customizable but must only be one "directory" deep (i.e., no
slashes).


=head1 AUTHOR

Jon Jensen <jon@icdevgroup.org>, March 2002

=cut


die <<EOF unless $ENV{MOD_PERL};

ic_mod_perl is meant to run only inside of Apache/mod_perl.
Please see the POD documentation for details:

perldoc $0

EOF


$Global::mod_perl = 1;

package main;
require '/home/jon/xfxf/bin/interchange';
#require '~_~INSTALLARCHLIB~_~/bin/interchange';


1;
Something went wrong with that request. Please try again.