27
27
Apache 2.0 is required. mod_perl 2.0 B<does not> work with Apache 1.3.
29
L<Dynamic|/MP_USE_DSO> (DSO) mod_perl build requires Apache 2.0.47 or
30
higher. L<Static|/MP_USE_STATIC> build requires Apache 2.0.51 or
35
Requires at least Perl version 5.6.0. But we strongly suggest to use
36
at least version 5.6.1, since 5.6.0 is quite buggy. The only reason we
37
support 5.6.0 is for development reasons (so the build can be tested
38
on systems having only 5.6.0) and those users who want to give it a
39
try, without first having the hassle of updating their perl version.
39
Requires at least Perl version 5.6.1.
41
41
You don't need to have threads-support enabled in Perl. If you do have
42
42
it, it B<must> be I<ithreads> and not I<5005threads>! If you have:
49
49
on some platforms it's unstable (e.g., FreeBSD), so don't enable it
50
50
unless you really need it.
54
54
Require at least Perl version 5.8.0 with ithreads support
55
55
built-in. That means that it should report:
61
61
If that's not what you see rebuild Perl with C<-Dusethreads>.
63
=item Static prefork build
65
Perl with ithreads support version 5.6.1 or higher
67
Perl without ithreads support version 5.8.2 or higher
69
=item Static non-prefork build
71
Perl with ithreads support version 5.8.0 or higher
65
75
If you want to run applications that take benefit of Perl's
88
98
=item Compress::Zlib 1.09
102
Though the easiest way to satisfy all the dependencies is to install
103
C<Bundle::Apache2> available from CPAN.
96
113
=head2 Downloading Stable Release Sources
98
115
If you are going to install mod_perl on a production site, you want to
129
=head2 Getting Bleeding Edge CVS Sources
146
=head2 Getting Bleeding Edge Sources
131
If you really know what you are doing you can use the cvs versions of
132
the components. Chances are that you don't want to them on a
148
If you really know what you are doing you can use the cvs/svn versions
149
of the components. Chances are that you don't want to them on a
133
150
production site. You have been warned!
139
CVS Perl (aka bleadperl or bleedperl) is only generally available
140
through an rsync repository maintained by ActiveState:
156
The cutting edge version of Perl (aka bleadperl or bleedperl) is only
157
generally available through an rsync repository maintained by
142
160
# (--delete to ensure a clean state)
143
161
% rsync -acvz --delete --force \
161
To download the cvs version of httpd-2.0 and bring it to the same
162
state of the distribution package, execute the following commands:
164
% cvs -d :pserver:anoncvs@cvs.apache.org:/home/cvspublic login
166
The password is "anoncvs". Now extract the C<APACHE_2_0_BRANCH> branch
167
of httpd-2.0.xx. If you don't use this branch you will get
168
httpd-2.1.xx which at this moment is not supported. Similarly you need
169
C<APR_0_9_BRANCH> and C<APU_0_9_BRANCH> cvs branches for apr and
170
apr-util projects, respectively.
172
% cvs -d :pserver:anoncvs@cvs.apache.org:/home/cvspublic co \
173
-r APACHE_2_0_BRANCH -d httpd-2.0 httpd-2.0
174
% cd httpd-2.0/srclib
175
% cvs -d :pserver:anoncvs@cvs.apache.org:/home/cvspublic co \
176
-r APR_0_9_BRANCH -d apr apr
177
% cvs -d :pserver:anoncvs@cvs.apache.org:/home/cvspublic co \
178
-r APU_0_9_BRANCH -d apr-util apr-util
179
% cvs -d :pserver:anoncvs@cvs.apache.org:/home/cvspublic co \
180
-r APU_0_9_BRANCH -d apr-iconv apr-iconv
184
Once extracted, whenever you want to sync with the latest httpd-2.0
185
version and rebuild, run:
189
% make distclean && ./buildconf
179
See L<Development mod_perl 2.0 Source
180
Distribution|download::source/Development_mod_perl_2_0_Source_Distribution>.
209
200
% ./Configure -des -Dusethreads
202
Most likely you don't want perl-support for threads enabled, in which
203
case pass: C<-Uusethreads> instead of C<-Dusethreads>.
211
205
If you want to debug mod_perl segmentation faults, add the
212
206
following I<./Configure> options:
219
You need to have Apache built and installed prior to building
220
mod_perl, only if you intend build a DSO mod_perl. If you intend to
221
build a statically linked Apache+mod_perl, you only need to have the
222
Apache source available (mod_perl will build and install Apache for
223
you), you should skip this step.
225
225
% cd httpd-2.x.xx
226
226
% ./configure --prefix=$HOME/httpd/prefork --with-mpm=prefork
227
227
% make && make install
271
271
=item Stable Release
273
Download from: I<http://perl.apache.org/download/>
273
Download from I<http://perl.apache.org/download/> or your favorite
275
276
This direct link which symlinks to the latest release should work too:
276
277
I<http://perl.apache.org/dist/mod_perl-2.0-current.tar.gz>.
286
287
or an equivalent command.
288
=item CVS Bleeding-Edge Version
290
To download the cvs version of modperl-2.0 execute the following
293
% cvs -d :pserver:anoncvs@cvs.apache.org:/home/cvspublic login
295
The password is "anoncvs".
297
% cvs -d :pserver:anoncvs@cvs.apache.org:/home/cvspublic co modperl-2.0
299
You can also try the latest CVS snapshot:
301
http://cvs.apache.org/snapshots/modperl-2.0/
289
=item Development Version
291
See L<Development mod_perl 2.0 Source
292
Distribution|download::source/Development_mod_perl_2_0_Source_Distribution>.
307
298
=head2 Configuring mod_perl
309
Before you proceed make sure that Apache 2.0 has been built and
310
installed. mod_perl B<cannot> be built before that.
300
To build mod_perl, you B<must> also use the same compiler that Perl
301
was built with. You can find that out by running C<perl -V> and
302
looking at the C<Compiler:> section.
312
304
Like any other Perl module, mod_perl is configured via the
313
305
I<Makefile.PL> file, but requires one or more configuration options:
315
307
% cd modperl-1.99_xx
316
308
% perl Makefile.PL <options>
318
where I<options> is an optional list of (key,value) pairs.
310
where I<options> is an optional list of key/value pairs. These
311
options can include all the usual options supported by
312
C<ExtUtils::MakeMaker> (e.g., C<PREFIX>, C<LIB>, etc.).
320
314
The following sections give the details about all the available
321
options, but let's mention first the most important ones.
323
If you want to have mod_perl 1.0 and 2.0 installed under the same perl
324
tree you need to enable C<L<MP_INST_APACHE2|/MP_INST_APACHE2>>:
326
% perl Makefile.PL MP_INST_APACHE2=1 <other options>
315
options, but let's mention first an important one.
317
Configuration options are discussed in L<Build
318
Options|/mod_perl_Build_Options>.
322
=head3 Dynamic mod_perl
324
Before you proceed, make sure that Apache 2.0 has been built and
325
installed. mod_perl B<cannot> be built before that.
328
327
It seems that most users use pre-packaged Apache installation, most of
329
328
which tend to spread the Apache files across many directories
333
332
option, which should be set to a full path to the C<apxs>
334
333
executable. For example:
336
% perl Makefile.PL MP_INST_APACHE2=1 MP_APXS=/path/to/apxs
335
% perl Makefile.PL MP_APXS=/path/to/apxs
338
337
For example RedHat Linux system installs the C<httpd> binary, the
339
338
C<apxs> and C<apr-config> scripts (the latter two are needed to build
340
339
mod_perl) all in different locations, therefore they configure
343
% perl Makefile.PL MP_INST_APACHE2=1 MP_APXS=/path/to/apxs \
342
% perl Makefile.PL MP_APXS=/path/to/apxs \
344
343
MP_APR_CONFIG=/another/path/to/apr-config <other options>
346
345
However a correctly built Apache shouldn't require the
351
350
directory, mod_perl 2.0's build only needs to know the path to that
352
351
directory, passed via the C<L<MP_AP_PREFIX|/MP_AP_PREFIX>> option:
354
% perl Makefile.PL MP_INST_APACHE2=1 MP_AP_PREFIX=$HOME/httpd/prefork
356
These and other options are discussed in the following sections.
353
% perl Makefile.PL MP_AP_PREFIX=$HOME/httpd/prefork
355
=head3 Static mod_perl
357
Before you proceed make sure that Apache 2.0 has been downloaded and
358
extracted. mod_perl B<cannot> be built before that.
360
If this is an svn checkout and not an official distribution tarball,
361
you need to first run:
366
To enable statically linking mod_perl into Apache, use the
367
C<L<MP_USE_STATIC|/MP_USE_STATIC>> flag like this:
369
% perl Makefile.PL MP_USE_STATIC=1 \
370
MP_AP_PREFIX=$HOME/src/httpd-2.x \
371
MP_AP_CONFIGURE="--with-mpm=prefork"
373
C<L<MP_AP_PREFIX|/MP_AP_PREFIX>> B<must> point to an extracted Apache
376
This will configure Apache by passing C<L<MP_AP_CONFIGURE|/MP_AP_CONFIGURE>>
377
to Apache's F<./configure> script.
379
=head2 mod_perl Build Options
358
381
=head3 Boolean Build Options
372
395
=head4 MP_USE_DSO
374
Build mod_perl as a DSO (I<mod_perl.so>). This is the default. It'll
375
be turned off if C<MP_USE_STATIC=1> is used.
397
Build mod_perl as a DSO (I<mod_perl.so>). This is the default.
377
399
=head4 MP_USE_STATIC
379
Build static mod_perl (I<mod_perl.a>). This is the default. It'll be
380
turned off if C<MP_USE_DSO=1> is used.
382
C<MP_USE_DSO> and C<MP_USE_STATIC> are both enabled by default. So
383
mod_perl is built once as I<mod_perl.a> and I<mod_perl.so>, but
384
afterwards you can choose which of the two to use.
386
META: The following is not implemented yet.
388
mod_perl and ends up with a src/modules/perl/mod_perl.{so,a} and
389
src/modules/perl/ldopts. to link modperl static with httpd, we just
390
need some config.m4 magic to add `ldopts` and mod_perl.a to the build.
391
so one could then build httpd like so:
393
ln -s ~/apache/modperl-2.0/src/modules/perl $PWD/src/modules
394
./configure --with-mpm=prefork --enable-perl=static ...
396
we not be configuring/building httpd for the user as 1.x attempted.
398
downside is one will need to have configured httpd first, so that
399
headers generated. so it will probably be more like:
401
./configure --with-mpm=prefork ...
403
./config.nice --enable-perl=static && make
405
we could of course provide a wrapper script todo this, but don't want
406
to have this stuff buried and tangled like it is in 1.x
401
Build static mod_perl (I<mod_perl.a>).
409
403
=head4 MP_STATIC_EXTS
411
Build C<Apache::*.xs> as static extensions.
405
Build C<Apache2::*.xs> as static extensions.
413
407
=head4 MP_USE_GTOP
440
434
in I<httpd.conf> or:
442
use Apache::Server ();
443
use Apache::ServerUtil ();
444
use Apache::Process ();
445
my $pool = Apache->server->process->pool;
446
push @INC, Apache::Server::server_root_relative($pool, "");
447
push @INC, Apache::Server::server_root_relative($pool, "lib/perl");
436
use Apache2::ServerUtil ();
437
use File::Spec::Functins qw(catfile);
438
push @INC, catfile Apache2::ServerUtil::server_root, "";
439
push @INC, catfile Apache2::ServerUtil::server_root, "lib/perl";
449
441
in I<startup.pl>.
502
490
I</home/httpd/httpd-2.0> as DSO, the default location would be
503
491
I</home/httpd/httpd-2.0/bin/apxs>.
493
=head4 MP_AP_CONFIGURE
495
The command-line arguments to pass to httpd's configure script.
505
497
=head4 MP_AP_PREFIX
507
499
Apache installation prefix, under which the I<include/> directory with
508
Apache C header files can be found. For example if you've have
509
installed Apache 2.0 in directory I<\Apache2> on Win32, you should
500
Apache C header files can be found. For example if you've installed
501
Apache 2.0 in directory I<\Apache2> on Win32, you should use:
512
503
MP_AP_PREFIX=\Apache2
528
519
% t/TEST -httpd /home/stas/httpd/prefork/bin/httpd
526
This option exists to make the lives of package maintainers easier. If
527
you aren't a package manager you should not need to use this option.
529
Apache installation destination directory. This path will be prefixed
530
to the installation paths for all Apache-specific files during C<make
531
install>. For instance, if Apache modules are normally installed into
532
I</path/to/httpd-2.0/modules/> and C<MP_AP_DESTDIR> is set to
533
I</tmp/foo>, the I<mod_perl.so> will be installed in:
535
/tmp/foo/path/to/httpd-2.0/modules/mod_perl.so
530
539
=head4 MP_APR_CONFIG
532
541
If APR wasn't installed under the same file tree as httpd, you may
550
559
MP_OPTIONS_FILE=~/.my_mod_perl2_opts
563
On Win32, in order to build the APR and APR::* modules so as to
564
be independent of mod_perl.so, a static library is first built
565
containing the needed functions these modules link into. The option
569
specifies the name that this library has. The default used
570
is C<aprext>. This option has no effect on platforms other than
571
Win32, as they use a different mechanism to accomplish the
572
decoupling of APR and APR::* from mod_perl.so.
554
574
=head3 mod_perl-specific Compiler Options
585
605
tracing which makes it easier to tell the reported errors and
586
606
warnings, from the rest of the notifications.
589
608
=head2 Re-using Configure Options
591
610
Since mod_perl remembers what build options were used to build it if