File: install.pod

package info (click to toggle)
libapache2-mod-perl2 2.0.9~1624218-2%2Bdeb8u2
  • links: PTS, VCS
  • area: main
  • in suites: jessie
  • size: 11,912 kB
  • ctags: 4,588
  • sloc: perl: 95,064; ansic: 14,527; makefile: 49; sh: 18
file content (741 lines) | stat: -rw-r--r-- 19,520 bytes parent folder | download | duplicates (7)
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
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
=head1 NAME

Installing mod_perl 2.0

=head1 Description

This chapter provides an in-depth mod_perl 2.0 installation coverage.






=head1 Prerequisites

Before building mod_perl 2.0 you need to have its prerequisites
installed. If you don't have them, download and install them first,
using the information in the following sections. Otherwise proceed
directly to the mod_perl building instructions.

The mod_perl 2.0 prerequisites are:

=over

=item * Apache

Apache 2.0 is required. mod_perl 2.0 B<does not> work with Apache 1.3.

L<Dynamic|/MP_USE_DSO> (DSO) mod_perl build requires Apache 2.0.47 or
higher. L<Static|/MP_USE_STATIC> build requires Apache 2.0.51 or
higher.

=item * Perl

=over

=item Prefork MPM

Requires at least Perl version 5.6.1.

You don't need to have threads-support enabled in Perl. If you do have
it, it B<must> be I<ithreads> and not I<5005threads>! If you have:

  % perl5.8.0 -V:use5005threads
  use5005threads='define';

you must rebuild Perl without threads enabled or with
C<-Dusethreads>. Remember that threads-support slows things down and
on some platforms it's unstable (e.g., FreeBSD), so don't enable it
unless you really need it.

=item 64 bit Linux

If while running C<make test> while building mod_perl 2 you get an error like
this:

  /usr/bin/ld: /usr/local/lib/perl5/5.10.1/x86_64-linux/CORE/libperl.a(op.o): \
  relocation R_X86_64_32S against `PL_sv_yes' can not be used when making a shared \
                  object; recompile with -fPIC
  /usr/local/lib/perl5/5.10.1/x86_64-linux/CORE/libperl.a: could not read symbols: Bad \
                  value

You're likely on 64 bit Linux and will need to build Perl for that platform.
You can do so by running Perl's C<Configure> with the C<$CFLAGS> environment
variable and the C<-A> and C<ccflags> options. So if you normally build Perl
with:

  % ./Configure -des

You would instead configure with:

  % CFLAGS='-m64 -mtune=nocona' ./Configure -des -A ccflags=-fPIC

=item Threaded MPMs

Require at least Perl version 5.8.0 with ithreads support
built-in. That means that it should report:

  % perl5.8.0 -V:useithreads -V:usemultiplicity
  useithreads='define';
  usemultiplicity='define';

If that's not what you see rebuild Perl with C<-Dusethreads>.

=item Static prefork build

Perl with ithreads support version 5.6.1 or higher

Perl without ithreads support version 5.8.2 or higher

=item Static non-prefork build

Perl with ithreads support version 5.8.0 or higher

=item threads.pm

If you want to run applications that take benefit of Perl's
I<threads.pm> Perl version 5.8.1 or higher w/ithreads enabled is
required. Perl 5.8.0's I<threads.pm> doesn't work with mod_perl 2.0.

=back

=item * CPAN Perl Modules

The mod_perl 2.0 test suite has several requirements on its own. If
you don't satisfy them, the tests depending on these requirements will
be skipped, which is OK, but you won't get to run these tests and
potential problems, which may exhibit themselves in your own code,
could be missed. We don't require them from C<Makefile.PL>, which
could have been automated the requirements installation, in order to
have less dependencies to get mod_perl 2.0 installed.

Also if your code uses any of these modules, chances are that you will
need to use at least the version numbers listed here.

=over

=item CGI.pm 3.11

=item Compress::Zlib 1.09

=back

Though the easiest way to satisfy all the dependencies is to install
C<Bundle::Apache2> available from CPAN.

=back







=head2 Downloading Stable Release Sources

If you are going to install mod_perl on a production site, you want to
use the officially released stable components. Since the latest stable
versions change all the time you should check for the latest stable
version at the listed below URLs:

=over

=item Perl

Download from: I<http://cpan.org/src/README.html>

This direct link which symlinks to the latest release should work too:
I<http://cpan.org/src/stable.tar.gz>.

For the purpose of examples in this chapter we will use the package
named I<perl-5.8.x.tar.gz>, where I<x> should be replaced with the
real version number.

=item Apache

Download from: I<http://www.apache.org/dist/httpd/>

For the purpose of examples in this chapter we will use the package
named I<httpd-2.x.xx.tar.gz>, where I<x.xx> should be replaced with
the real version number.


=back



=head2 Getting Bleeding Edge Sources

If you really know what you are doing you can use the cvs/svn versions
of the components. Chances are that you don't want to them on a
production site. You have been warned!

=over

=item Perl

The cutting edge version of Perl (aka bleadperl or bleedperl) is only
generally available through an rsync repository maintained by
ActiveState:

  # (--delete to ensure a clean state)
  % rsync -acvz --delete --force \
    rsync://public.activestate.com/perl-current/ perl-current

If you are re-building Perl after rsync-ing, make sure to cleanup first:

  % make distclean

before running C<./Configure>.

You'll also want to install (at least) LWP if you want to fully test
mod_perl. You can install LWP with C<CPAN.pm> shell:

  % perl -MCPAN -e 'install("LWP")'

For more details on bleadperl, see I<http://dev.perl.org/perl5/source.html>.

=item Apache

See L<Development mod_perl 2.0 Source
Distribution|download::source/Development_mod_perl_2_0_Source_Distribution>.

=back



=head2 Configuring and Installing Prerequisites

If you don't have the prerequisites installed yet, install them now.



=head3 Perl

  % cd perl-5.8.x
  % ./Configure -des

If you L<need the threads
support|docs::2.0::user::install::install/Prerequisites>, run:

  % ./Configure -des -Dusethreads

Most likely you don't want perl-support for threads enabled, in which
case pass: C<-Uusethreads> instead of C<-Dusethreads>.

If you want to debug mod_perl segmentation faults, add the
following I<./Configure> options:

  -Doptimize='-g' -Dusedevel

Now build it:

  % make && make test && make install




=head3 Apache

You need to have Apache built and installed prior to building
mod_perl, only if you intend build a DSO mod_perl. If you intend to
build a statically linked Apache+mod_perl, you only need to have the
Apache source available (mod_perl will build and install Apache for
you), you should skip this step.

  % cd httpd-2.x.xx
  % ./configure --prefix=$HOME/httpd/prefork --with-mpm=prefork
  % make && make install

Starting from 2.0.49, the Apache logging API escapes everything that
goes to F<error_log>, therefore if you're annoyed by this feature
during the development phase (as your error messages will be all
messed up) you can disable the escaping during the Apache build time:

  % CFLAGS="-DAP_UNSAFE_ERROR_LOG_UNESCAPED" ./configure ...

Do B<not> use that CFLAGS in production unless you know what you are
doing.




=head1 Installing mod_perl from Binary Packages

As of this writing only the binaries for the Win32 platform are
available, kindly prepared and maintained by Randy Kobes.
See the documentation on L<Win32 binaries|docs::2.0::os::win32::install>
for details.

Some RPM packages can be found using rpmfind services, e.g.:

http://www.rpmfind.net/linux/rpm2html/search.php?query=mod_perl&submit=Search+...
However if you have problems using them, you have to contact those who
have created them.


=head1 Installing mod_perl from Source

Building from source is the best option, because it ensures a binary
compatibility with Apache and Perl. However it's possible that your
distribution provides a solid binary mod_perl 2.0 package.

For Win32 specific details, see the documentation on
L<Win32 installation|docs::2.0::os::win32::install>.

=head2 Downloading the mod_perl Source

First download the mod_perl source.

=over

=item Stable Release

Download from I<http://perl.apache.org/download/> or your favorite
CPAN mirror.

This direct link which symlinks to the latest release should work too:
I<http://apache.org/dist/perl/mod_perl-2.0-current.tar.gz>.

For the purpose of examples in this chapter we will use the package
named I<mod_perl-2.x.x.tar.gz>, where I<x.x> should be replaced with
the real version number.

Open the package with:

  % tar -xvzf mod_perl-2.x.x.tar.gz

or an equivalent command.

=item Development Version

See L<Development mod_perl 2.0 Source
Distribution|download::source/Development_mod_perl_2_0_Source_Distribution>.

=back



=head2 Configuring mod_perl

To build mod_perl, you B<must> also use the same compiler that Perl
was built with. You can find that out by running C<perl -V> and
looking at the C<Compiler:> section.

Like any other Perl module, mod_perl is configured via the
I<Makefile.PL> file, but requires one or more configuration options:

  % cd modperl-2.x.x
  % perl Makefile.PL <options>

where I<options> is an optional list of key/value pairs.  These
options can include all the usual options supported by
C<ExtUtils::MakeMaker> (e.g., C<PREFIX>, C<LIB>, etc.).

The following sections give the details about all the available
options, but let's mention first an important one.

Configuration options are discussed in L<Build
Options|/mod_perl_Build_Options>.



=head3 Dynamic mod_perl

Before you proceed, make sure that Apache 2.0 has been built and
installed. mod_perl B<cannot> be built before that.

It seems that most users use pre-packaged Apache installation, most of
which tend to spread the Apache files across many directories
(i.e. not using --enable-layout=Apache, which puts all the files under
the same directory). If Apache 2.0 files are spread under different
directories, you need to use at least the C<L<MP_APXS|/MP_APXS>>
option, which should be set to a full path to the C<apxs>
executable. For example:

  % perl Makefile.PL MP_APXS=/path/to/apxs

For example RedHat Linux system installs the C<httpd> binary, the
C<apxs> and C<apr-config> scripts (the latter two are needed to build
mod_perl) all in different locations, therefore they configure
mod_perl 2.0 as:

  % perl Makefile.PL MP_APXS=/path/to/apxs \
    MP_APR_CONFIG=/another/path/to/apr-config <other options>

However a correctly built Apache shouldn't require the
C<L<MP_APR_CONFIG|/MP_APR_CONFIG>> option, since
C<L<MP_APXS|/MP_APXS>> should provide the location of this script.

If however all Apache 2.0 files were installed under the same
directory, mod_perl 2.0's build only needs to know the path to that
directory, passed via the C<L<MP_AP_PREFIX|/MP_AP_PREFIX>> option:

  % perl Makefile.PL MP_AP_PREFIX=$HOME/httpd/prefork

=head3 Static mod_perl

Before you proceed make sure that Apache 2.0 has been downloaded and
extracted. mod_perl B<cannot> be built before that.

If this is an svn checkout and not an official distribution tarball,
you need to first run:

  % cd httpd-2.0
  % ./buildconf

To enable statically linking mod_perl into Apache, use the
C<L<MP_USE_STATIC|/MP_USE_STATIC>> flag like this:

  % perl Makefile.PL MP_USE_STATIC=1 \
    MP_AP_PREFIX=$HOME/src/httpd-2.x \
    MP_AP_CONFIGURE="--with-mpm=prefork"

C<L<MP_AP_PREFIX|/MP_AP_PREFIX>> B<must> point to an extracted Apache
2.0 source tree.

This will configure Apache by passing C<L<MP_AP_CONFIGURE|/MP_AP_CONFIGURE>>
to Apache's F<./configure> script.

Here is an example:

  % cd ~/src
  % tar -xvzf perl-5.8.x.tar.gz
  % cd perl-5.8.x
  % ./Configure -des
  % make install
  % cd ..
  % tar -xvzf httpd-2.0.xx.tar.gz
  % tar -xvzf mod_perl-2.x.x.tar.gz 
  % perl5.8.x Makefile.PL \
    MP_USE_STATIC=1 \
    MP_AP_PREFIX="$HOME/src/httpd-2.0.xx" \
    MP_AP_CONFIGURE="--with-mpm=prefork"
  % make
  % make test
  % make install
  % ./httpd -l | grep perl
     mod_perl.c

=head2 mod_perl Build Options

=head3 Boolean Build Options

The following options are boolean and can be set with C<MP_XXX=1> or
unset with C<MP_XXX=0>, where XXX is the name of the option.

=head4 MP_PROMPT_DEFAULT

Accept default values for all would-be prompts.

=head4 MP_GENERATE_XS

Generate XS code from parsed source headers in I<xs/tables/$httpd_version>.
Default is 1, set to 0 to disable.

=head4 MP_USE_DSO

Build mod_perl as a DSO (I<mod_perl.so>). This is the default.

=head4 MP_USE_STATIC

Build static mod_perl (I<mod_perl.a>).

=head4 MP_STATIC_EXTS

Build C<Apache2::*.xs> as static extensions.

=head4 MP_USE_GTOP

Link with I<libgtop> and enable I<libgtop> reporting.

=head4 MP_COMPAT_1X

C<MP_COMPAT_1X=1> or a lack of it enables several mod_perl 1.0
back-compatibility features, which are deprecated in mod_perl
2.0. It's enabled by default, but can be disabled with
C<MP_COMPAT_1X=0> during the build process.

When this option is disabled, the following things will happen:

=over

=item *

Deprecated special variable, C<$Apache2::__T> won't be available. Use
C<${^TAINT}> instead.

=item *

I<$ServerRoot> and I<$ServerRoot/lib/perl> won't be appended to
C<@INC>. Instead use:

  PerlSwitches -I/path/to/server -I/path/to/server/lib/perl

in I<httpd.conf> or:

  use Apache2::ServerUtil ();
  use File::Spec::Functions qw(catfile);
  push @INC, catfile Apache2::ServerUtil::server_root, "";
  push @INC, catfile Apache2::ServerUtil::server_root, "lib/perl";

in I<startup.pl>.

=item *

The following deprecated configuration directives won't be recognized
by Apache:

  PerlSendHeader
  PerlSetupEnv
  PerlHandler
  PerlTaintCheck
  PerlWarn

Use L<their 2.0
equivalents|docs::2.0::user::porting::compat/Configuration_Files_Porting>
instead.

=back



=head4 MP_DEBUG

Turn on debugging (C<-g -lperld>) and tracing.

=head4 MP_MAINTAINER

Enable maintainer compile mode, which sets C<MP_DEBUG=1> and adds the
following C<gcc> flags:

  -DAP_DEBUG -Wall -Wmissing-prototypes -Wstrict-prototypes \
  -Wmissing-declarations \

If gcc version 3.3.2+ is found, not compiling on OpenBSD,
and C<-Wdeclaration-after-statement> is
not already part of the C<gcc> flags add it.

To use this mode Apache must be build with
C<--enable-maintainer-mode>.

=head4 MP_TRACE

Enable tracing


=head3 Non-Boolean Build Options

set the non-boolean options with MP_XXX=value.

=head4 MP_APXS

Path to C<apxs>. For example if you've installed Apache 2.0 under
I</home/httpd/httpd-2.0> as DSO, the default location would be
I</home/httpd/httpd-2.0/bin/apxs>.

=head4 MP_AP_CONFIGURE

The command-line arguments to pass to httpd's configure script.

=head4 MP_AP_PREFIX

Apache installation prefix, under which the I<include/> directory with
Apache C header files can be found. For example if you've installed
Apache 2.0 in directory I<\Apache2> on Win32, you should use:

  MP_AP_PREFIX=\Apache2

If Apache is not installed yet, you can point to the Apache 2.0 source
directory, but only after you've built or configured Apache in it. For
example:

  MP_AP_PREFIX=/home/stas/apache.org/httpd-2.0

Though in this case C<make test> won't automatically find C<httpd>,
therefore you should run C<t/TEST> instead and pass the location of
C<apxs> or C<httpd>, e.g.:

  % t/TEST -apxs /home/stas/httpd/prefork/bin/apxs

or

  % t/TEST -httpd /home/stas/httpd/prefork/bin/httpd




=head4 MP_AP_DESTDIR

This option exists to make the lives of package maintainers easier. If
you aren't a package manager you should not need to use this option.

Apache installation destination directory.  This path will be prefixed
to the installation paths for all Apache-specific files during C<make
install>.  For instance, if Apache modules are normally installed into
I</path/to/httpd-2.0/modules/> and C<MP_AP_DESTDIR> is set to
I</tmp/foo>, the I<mod_perl.so> will be installed in:

  /tmp/foo/path/to/httpd-2.0/modules/mod_perl.so



=head4 MP_APR_CONFIG

If APR wasn't installed under the same file tree as httpd, you may
need to tell the build process where it can find the executable
C<apr-config>, which can then be used to figure out where the apr and
aprutil I<include/> and I<lib/> directories can be found.

=head4 MP_CCOPTS

Add to compiler flags, e.g.:

  MP_CCOPTS=-Werror

(Notice that C<-Werror> will work only with the Perl version 5.7 and
higher.)

=head4 MP_OPTIONS_FILE

Read build options from given file. e.g.:

  MP_OPTIONS_FILE=~/.my_mod_perl2_opts

=head4 MP_APR_LIB

On Win32, in order to build the APR and APR::* modules so as to
be independent of mod_perl.so, a static library is first built
containing the needed functions these modules link into. The option

  MP_APR_LIB=aprext

specifies the name that this library has. The default used
is C<aprext>. This option has no effect on platforms other than
Win32, as they use a different mechanism to accomplish the
decoupling of APR and APR::* from mod_perl.so.

=head3 mod_perl-specific Compiler Options

=head4 -DMP_IOBUFSIZE

Change the default mod_perl's 8K IO buffer size, e.g. to 16K:

  MP_CCOPTS=-DMP_IOBUFSIZE=16384

=head3 mod_perl Options File

Options can also be specified in the file I<makepl_args.mod_perl2> or
I<.makepl_args.mod_perl2>. The file can be placed under C<$ENV{HOME}>,
the root of the source package or its parent directory. So if you
unpack the mod_perl source into I</tmp/mod_perl-2.x/> and your home is
I</home/foo/>, the file will be searched in:

  /tmp/mod_perl-2.x/makepl_args.mod_perl2
  /tmp/makepl_args.mod_perl2
  /home/foo/makepl_args.mod_perl2
  /tmp/mod_perl-2.x/.makepl_args.mod_perl2
  /tmp/.makepl_args.mod_perl2
  /home/foo/.makepl_args.mod_perl2

If the file specified in C<MP_OPTIONS_FILE> is found the
I<makepl_args.mod_perl2> will be ignored.

Options specified on the command line override those from
I<makepl_args.mod_perl2> and those from C<MP_OPTIONS_FILE>.

If your terminal supports colored text you may want to set the
environment variable C<APACHE_TEST_COLOR> to 1 to enable the colored
tracing which makes it easier to tell the reported errors and
warnings, from the rest of the notifications.

=head2 Re-using Configure Options

Since mod_perl remembers what build options were used to build it if
first place, you can use this knowledge to rebuild itself using the
same options. Simply C<chdir(1)> to the mod_perl source directory and
run:

  % cd modperl-2.x.
  % perl -MApache2::Build -e rebuild



=head2 Compiling mod_perl

Next stage is to build mod_perl:

  % make



=head2 Testing mod_perl

When mod_perl has been built, it's very important to test that
everything works on your machine:

  % make test

If something goes wrong with the test phase and want to figure out how
to run individual tests and pass various options to the test suite,
see the corresponding sections of L<the bug reporting
guidelines|docs::2.0::user::help::help/_C_make_test___Failures> or
the L<Apache::Test
Framework|docs::general::testing::testing/Running_Tests> tutorial.

=head2 Installing mod_perl

Once the test suite has passed, it's a time to install mod_perl.

  % make install

If you install mod_perl system wide, you probably need to become
I<root> prior to doing the installation:

  % su
  # make install



=head1 If Something Goes Wrong

If something goes wrong during the installation, try to repeat the
installation process from scratch, while verifying all the steps with
this document.

If the problem persists L<report the
problem|docs::2.0::user::help::help/Reporting_Problems>.

=head1 Maintainers

Maintainer is the person(s) you should contact with updates,
corrections and patches.

=over

=item *

Stas Bekman [http://stason.org/]

=back

=head1 Authors

=over

=item *

Stas Bekman [http://stason.org/]

=item *

Doug MacEachern E<lt>dougm (at) covalent.netE<gt>

=back

Only the major authors are listed above. For contributors see the
Changes file.


=cut