File: install.unix.html

package info (click to toggle)
php3 3%3A3.0.18-0potato1.1
  • links: PTS
  • area: main
  • in suites: potato
  • size: 17,736 kB
  • ctags: 11,198
  • sloc: ansic: 108,120; sh: 2,512; php: 2,024; yacc: 1,887; makefile: 1,038; perl: 537; pascal: 238; awk: 90; cpp: 28; sql: 11
file content (714 lines) | stat: -rw-r--r-- 13,277 bytes parent folder | download | duplicates (3)
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
<HTML
><HEAD
><TITLE
>Installation on UNIX systems</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.57"><LINK
REL="HOME"
TITLE="PHP Manual"
HREF="manual.html"><LINK
REL="UP"
TITLE="Installation"
HREF="installation.html"><LINK
REL="PREVIOUS"
TITLE="Installation"
HREF="installation.html"><LINK
REL="NEXT"
TITLE="Complete list of configure options"
HREF="install.configure.html"><META
NAME="HTTP_EQUIV"
CONTENT="text/html; charset=ISO-8859-1"></HEAD
><BODY
CLASS="sect1"
BGCOLOR="#FFFFFF"
TEXT="#000000"
LINK="#0000FF"
VLINK="#840084"
ALINK="#0000FF"
><DIV
CLASS="NAVHEADER"
><TABLE
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>PHP Manual</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="installation.html"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
>Chapter 2. Installation</TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="install.configure.html"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="sect1"
><H1
CLASS="sect1"
><A
NAME="install.unix"
>Installation on UNIX systems</A
></H1
><P
>&#13;    This section will guide you through the configuration and
    installation of PHP. 
   </P
><P
>&#13;    Prerequisite knowledge and software:
    
    <P
></P
><UL
><LI
><P
>&#13;       Basic UNIX skills (being able to operate "make" and a C
       compiler)
      </P
></LI
><LI
><P
>&#13;       An ANSI C compiler
      </P
></LI
><LI
><P
>&#13;       A web server
      </P
></LI
></UL
>
   </P
><P
>&#13;    There are several ways to compile and configure PHP for the Unix
    platform. The entire configuration process is controlled by the
    use of commandline options to the <TT
CLASS="filename"
>configure</TT
>
    script. This page outlines the usage of the most common options,
    but there are many others to play with. Check out the <A
HREF="install.configure.html"
>Complete list of configure
     options</A
> for an exhaustive rundown.
    <P
></P
><UL
><LI
><P
>&#13;       As an <A
HREF="install.unix.html#install.unix.apache-module"
>Apache module</A
>
      </P
></LI
><LI
><P
>&#13;       As an <A
HREF="install.unix.html#install.unix.fhttpd"
>fhttpd module</A
>
      </P
></LI
><LI
><P
>&#13;       For use with <A
HREF="install.unix.html#install.unix.otherhttpd"
>AOLServer, NSAPI,
       phttpd, Pi3Web, Roxen, thttpd, or Zeus.</A
>
      </P
></LI
><LI
><P
>&#13;       As a <A
HREF="install.unix.html#install.unix.commandline"
>CGI executable</A
>
      </P
></LI
></UL
>
   </P
><DIV
CLASS="sect2"
><H2
CLASS="sect2"
><A
NAME="install.unix.apache-module"
>Apache Module</A
></H2
><P
>&#13;     PHP can be compiled in a number of different ways as an Apache
     module. First we show the quick instructions. Following this is
     a list of various examples with explanations, to provide an
     overview of how to accomplish certain things.
    </P
><P
>&#13;     You can select arguments to add to the
     <B
CLASS="command"
>configure</B
> on line 8 below from the <A
HREF="install.configure.html"
>Complete list of configure
     options</A
>.
    </P
><TABLE
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
CLASS="EXAMPLE"
><TR
><TD
><DIV
CLASS="example"
><A
NAME="install.unix.apache-module.quick"
></A
><P
><B
>Example 2-1. 
      Quick Installation Instructions (Apache Module Version)
     </B
></P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><PRE
CLASS="programlisting"
>&#13;1.  gunzip apache_1.3.x.tar.gz
2.  tar xvf apache_1.3.x.tar
3.  gunzip php-x.x.x.tar.gz
4.  tar xvf php-x.x.x.tar
5.  cd apache_1.3.x
6.  ./configure --prefix=/www
7.  cd ../php-x.x.x
8.  ./configure --with-mysql --with-apache=../apache_1.3.x --enable-track-vars
9.  make
10. make install
11. cd ../apache_1.3.x
12. for PHP 3: ./configure --activate-module=src/modules/php3/libphp3.a
    for PHP 4: ./configure --activate-module=src/modules/php4/libphp4.a
13. make
14. make install

  Instead of this step you may prefer to simply copy the httpd binary
  overtop of your existing binary.  Make sure you shut down your
  server first though.

15. cd ../php-x.x.x
16. for PHP 3: cp php3.ini-dist /usr/local/lib/php3.ini
    for PHP 4: cp php.ini-dist /usr/local/lib/php.ini

  You can edit your .ini file to set PHP options.  If
  you prefer this file in another location, use
  --with-config-file-path=/path in step 8.

17. Edit your httpd.conf or srm.conf file and add: 
      
     For PHP 3:   AddType application/x-httpd-php3 .php3
     For PHP 4:   AddType application/x-httpd-php .php
 
  You can choose any extension you wish here.  .php is simply the one
  we suggest. You can even include .html .


18. Use your normal procedure for starting the Apache server. (You must
    stop and restart the server, not just cause the server to reload by
    use a HUP or USR1 signal.)
      </PRE
></TD
></TR
></TABLE
></DIV
></TD
></TR
></TABLE
><P
>&#13;      <DIV
CLASS="informalexample"
><A
NAME="AEN165"
></A
><P
></P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><PRE
CLASS="programlisting"
>&#13;./configure --with-apxs --with-pgsql
       </PRE
></TD
></TR
></TABLE
><P
></P
></DIV
>
     </P
><P
>&#13;      This will create a <TT
CLASS="filename"
>libphp4.so</TT
> shared
      library that is loaded into Apache using a LoadModule line in
      Apache's <TT
CLASS="filename"
>httpd.conf</TT
> file. The PostgreSQL
      support is embedded into this <TT
CLASS="filename"
>libphp4.so</TT
>
      library.
     </P
><P
>&#13;      <DIV
CLASS="informalexample"
><A
NAME="AEN172"
></A
><P
></P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><PRE
CLASS="programlisting"
>&#13;./configure --with-apxs --with-pgsql=shared
       </PRE
></TD
></TR
></TABLE
><P
></P
></DIV
>
     </P
><P
>&#13;      This will again create a <TT
CLASS="filename"
>libphp4.so</TT
> shared
      library for Apache, but it will also create a
      <TT
CLASS="filename"
>pgsql.so</TT
> shared library that is loaded into
      PHP either by using the extension directive in
      <TT
CLASS="filename"
>php.ini</TT
> file or by loading it explicitly in
      a script using the <A
HREF="function.dl.html"
><B
CLASS="function"
>dl()</B
></A
> function.
     </P
><P
>&#13;      <DIV
CLASS="informalexample"
><A
NAME="AEN180"
></A
><P
></P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><PRE
CLASS="programlisting"
>&#13;./configure --with-apache=/path/to/apache_source --with-pgsql
       </PRE
></TD
></TR
></TABLE
><P
></P
></DIV
>
     </P
><P
>&#13;      This will create a <TT
CLASS="filename"
>libmodphp4.a</TT
> library, a
      <TT
CLASS="filename"
>mod_php4.c</TT
> and some accompanying files and
      copy this into the <TT
CLASS="literal"
>src/modules/php4</TT
> directory
      in the Apache source tree. Then you compile Apache using
      <TT
CLASS="literal"
>--activate-module=src/modules/php4/libphp4.a</TT
>
      and the Apache build system will create
      <TT
CLASS="filename"
>libphp4.a</TT
> and link it statically into the
      <TT
CLASS="filename"
>httpd</TT
> binary. The PostgreSQL support is
      included directly into this <TT
CLASS="filename"
>httpd</TT
> binary,
      so the final result here is a single <TT
CLASS="filename"
>httpd</TT
>
      binary that includes all of Apache and all of PHP.
     </P
><P
>&#13;      <DIV
CLASS="informalexample"
><A
NAME="AEN192"
></A
><P
></P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><PRE
CLASS="programlisting"
>&#13;./configure --with-apache=/path/to/apache_source --with-pgsql=shared
       </PRE
></TD
></TR
></TABLE
><P
></P
></DIV
>
     </P
><P
>&#13;      Same as before, except instead of including PostgreSQL support
      directly into the final <TT
CLASS="filename"
>httpd</TT
> you will get
      a <TT
CLASS="filename"
>pgsql.so</TT
> shared library that you can load
      into PHP from either the <TT
CLASS="filename"
>php.ini</TT
> file or
      directly using <A
HREF="function.dl.html"
><B
CLASS="function"
>dl()</B
></A
>.
     </P
><P
>&#13;      When choosing to build PHP in different ways, you should consider
      the advantages and drawbacks of each method. Building as a shared
      object will mean that you can compile apache separately, and don't
      have to recompile everything as you add to, or change, PHP.
      Building PHP into apache (static method) means that PHP will
      load and run faster. For more information, see the Apache
      <A
HREF="http://www.apache.org/docs/dso.html"
TARGET="_top"
>webpage on DSO support</A
>.
     </P
></DIV
><DIV
CLASS="sect2"
><H2
CLASS="sect2"
><A
NAME="install.unix.fhttpd"
>fhttpd Module</A
></H2
><P
>&#13;     To build PHP as an fhttpd module, answer "yes" to "Build as an
     fhttpd module?" (the <TT
CLASS="option"
><A
HREF="install.configure.html#install.configure.with-fhttpd"
>&#13;     --with-fhttpd</A
>=<TT
CLASS="replaceable"
><I
>DIR</I
></TT
></TT
>
     option to configure) and specify the fhttpd source base
     directory.  The default directory is <TT
CLASS="filename"
>/usr/local/src/fhttpd</TT
>. If you are
     running fhttpd, building PHP as a module will give better
     performance, more control and remote execution capability.
    </P
></DIV
><DIV
CLASS="sect2"
><H2
CLASS="sect2"
><A
NAME="install.unix.otherhttpd"
>Other web servers</A
></H2
><P
>&#13;     PHP can be built to support a large number of web servers. Please
     see <A
HREF="install.configure.html#install.configure.servers"
>Server-related
      options</A
> for a full list of server-related configure
     options.
    </P
></DIV
><DIV
CLASS="sect2"
><H2
CLASS="sect2"
><A
NAME="install.unix.commandline"
>CGI/Commandline version</A
></H2
><P
>&#13;     The default is to build PHP as a CGI program.  This creates a
     commandline interpreter, which can be used for CGI processing, or
     for non-web-related PHP scripting.  If you are running a web
     server PHP has module support for, you should generally go for
     that solution for performance reasons.  However, the CGI version
     enables Apache users to run different PHP-enabled pages under
     different user-ids.  Please make sure you read through the <A
HREF="security.html"
>Security chapter</A
> if you are going to
     run PHP as a CGI.
    </P
></DIV
><DIV
CLASS="sect2"
><H2
CLASS="sect2"
><A
NAME="database-support-options"
>Database Support Options</A
></H2
><P
>&#13;     PHP has native support for a number of databases (as well as
     ODBC). To enable support for the various databases, options are
     given to the <TT
CLASS="filename"
>configure</TT
> script at compile
     time. Read the <A
HREF="install.configure.html#install.configure.databases"
>list
     of all database-related options</A
> for more information.
    </P
><P
>&#13;     For a list of all possible options to
     <TT
CLASS="filename"
>configure</TT
>, please see the <A
HREF="install.configure.html"
>Complete list of configure
      options</A
>.
    </P
></DIV
><DIV
CLASS="sect2"
><H2
CLASS="sect2"
><A
NAME="AEN224"
>Building</A
></H2
><P
>&#13;     When PHP is configured, you are ready to build the CGI executable
     or the PHP library.  The command <B
CLASS="command"
>make</B
> should
     take care of this.  If it fails and you can't figure out why, see
     the <A
HREF="install-problems.html"
>Problems section</A
>.
    </P
></DIV
><DIV
CLASS="sect2"
><H2
CLASS="sect2"
><A
NAME="AEN229"
>Testing</A
></H2
><P
>&#13;     If you have built PHP as a CGI program, you may test your build
     by typing <B
CLASS="command"
>make test</B
>.  It is always a good idea
     to test your build.  This way you may catch a problem with PHP on
     your platform early instead of having to struggle with it later.
    </P
></DIV
><DIV
CLASS="sect2"
><H2
CLASS="sect2"
><A
NAME="AEN233"
>Benchmarking</A
></H2
><P
>&#13;     If you have built PHP as a CGI program, you may benchmark your
     build by typing <B
CLASS="command"
>make bench</B
>. Note that if safe
     mode is on by default, the benchmark may not be able to finish if
     it takes longer then the 30 seconds allowed. This is because the
     <A
HREF="function.set-time-limit.html"
><B
CLASS="function"
>set_time_limit()</B
></A
> can not be used in safe
     mode. Use the <A
HREF="configuration.html#ini.max-execution-time"
>max_execution_time</A
>
     configuration setting to control this time for your own
     scripts. <B
CLASS="command"
>make bench</B
> ignores the <A
HREF="configuration.html#configuration.file"
>configuration file</A
>.
    </P
></DIV
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="installation.html"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="manual.html"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="install.configure.html"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>Installation</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="installation.html"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>Complete list of configure options</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>