api.html
7.9 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
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>Appendix I. Compiling PHP</title><link rel="stylesheet" type="text/css" href="manual.css"><meta name="generator" content="DocBook XSL Stylesheets V1.76.0"><link rel="home" href="index.html" title="JpGraph Manual"><link rel="up" href="pt09.html" title="Part IX. Appendices"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Appendix I. Compiling PHP</th></tr><tr><td width="20%" align="left"> </td><th width="60%" align="center">Part IX. Appendices</th><td width="20%" align="right"> </td></tr></table><hr></div><div class="appendix" title="Appendix I. Compiling PHP"><div class="titlepage"><div><div><h2 class="title"><a name="app.compile-php"></a>Appendix I. Compiling PHP</h2></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="sect1"><a href="api.html#id2654072">I.1. Compiling PHP4</a></span></dt><dd><dl><dt><span class="sect2"><a href="api.html#id2654077">I.1.1. Client version</a></span></dt><dt><span class="sect2"><a href="api.html#id2654090">I.1.2. Apache module</a></span></dt><dt><span class="sect2"><a href="api.html#id2654100">I.1.3. CGI extension</a></span></dt></dl></dd><dt><span class="sect1"><a href="apis02.html">I.2. Compiling PHP5</a></span></dt><dd><dl><dt><span class="sect2"><a href="apis02.html#id2654119">I.2.1. Client version</a></span></dt><dt><span class="sect2"><a href="apis02.html#id2654131">I.2.2. Apache module</a></span></dt><dt><span class="sect2"><a href="apis02.html#id2654142">I.2.3. CGI extension</a></span></dt></dl></dd></dl></div>
<p>Usually the included PHP version is adequate but if problems persists it is a good idea to
be able to compile PHP yourself. This way you will also be able to more quickly upgrade to
newer version of PHP which might have fix for a particular nasty bug that may have crept
in.</p>
<p> In the following sections we give examples of Unix shell scripts that will show typical
compile configuration for a downloaded PHP distribution. These compile configuration scripts
will make both the GD and FreeType libraries included in the executable. </p>
<p>In order to compile your downloaded PHP distribution first copy and save these scripts to
a local file and make that file runnable. Then run one of the selected configurations below
and do a normal "make". </p>
<div class="tip" title="Tip" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Tip</h3>
<p>When running <code class="code">make</code> you can speed up the compilation by telling make to use
a number of parallel compile processes. Since most modern system have at least two cores
a typical invocation of make would be to make use of three parallel compile time
processes. This is done by using the <code class="code">-j</code> argument. For example as
</p><pre class="screen">make -j3</pre>
</div>
<p>It is possible to compile PHP into (at least) three variants </p>
<div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">
<p>as a command line tool</p>
</li><li class="listitem">
<p>as a Apache extension module (this is probably the most common variant)</p>
</li><li class="listitem">
<p>as a CGI module to be used by a HTTP server (this is slower than running PHP
as a module since it needs to be read from disk and the process created every
time a PHP script needs to be executed.)</p>
</li></ol></div><p>There is one crucial difference of importance when using PHP to generate
images. Both the CGI module and the client variant are both standalone executables so what
is the difference? The crucial difference is that the CGI module will by default output a
MIME header before it outputs data while the client version will not. </p>
<p>The following sections have one compile script for each of the three major
versions.</p>
<div class="caution" title="Caution" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Caution</h3>
<p>You should make sure that the proposed directory paths in the scripts match your
particular server setup as this can vary from system to system. </p>
</div>
<div class="sect1" title="Compiling PHP4"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id2654072"></a>Compiling PHP4</h2></div></div></div>
<div class="sect2" title="Client version"><div class="titlepage"><div><div><h3 class="title"><a name="id2654077"></a>Client version</h3></div></div></div>
<pre class="screen">#! /bin/sh
./configure --prefix=/usr/share --datadir=/usr/share/php \
--libdir=/usr/share/php --includedir=/usr/include \
--bindir=/usr/bin \
--with-config-file-path=/etc/php4/cli \
--with-config-file-scan-dir=/etc/php4/cli \
--enable-mbstring --enable-mbregex \
--with-mysql \
--with-gd --enable-gd-imgstrttf --enable-gd-native-ttf \
--with-zlib-dir=/usr/lib \
--with-png-dir=/usr/lib --with-jpeg-dir=/usr/lib --with-xpm-dir=/usr/X11R6 \
--with-tiff-dir=/usr/lib --with-ttf-dir=/usr/lib \
--with-freetype-dir=/usr/lib \
--enable-ftp \
--enable-memory-limit \
--enable-bcmath -enable-calendar \
--enable-ctype --with-ftp \
--enable-magic-quotes \
--enable-inline-optimization \
--with-bz2 \
--with-iconv
</pre>
</div>
<div class="sect2" title="Apache module"><div class="titlepage"><div><div><h3 class="title"><a name="id2654090"></a>Apache module</h3></div></div></div>
<pre class="screen">#! /bin/sh
./configure --prefix=/usr/share --datadir=/usr/share/php --with-apxs2=/usr/sbin/apxs2 \
--libdir=/usr/share --includedir=/usr/include \
--bindir=/usr/bin \
--with-config-file-path=/etc/php4/apache2 \
--enable-mbstring --enable-mbregex \
--with-mysql \
--with-gd --enable-gd-imgstrttf --enable-gd-native-ttf \
--with-zlib-dir=/usr/lib \
--with-png-dir=/usr/lib --with-jpeg-dir=/usr/lib --with-xpm-dir=/usr/X11R6 \
--with-tiff-dir=/usr/lib --with-ttf-dir=/usr/lib \
--with-freetype-dir=/usr/lib \
--enable-ftp \
--enable-memory-limit \
--bindir=/usr/bin \
--enable-bcmath \
--enable-calendar \
--enable-ctype \
--with-ftp \
--enable-magic-quotes \
--enable-inline-optimization \
--with-bz2 \
--with-iconv
</pre>
</div>
<div class="sect2" title="CGI extension"><div class="titlepage"><div><div><h3 class="title"><a name="id2654100"></a>CGI extension</h3></div></div></div>
<pre class="screen">#! /bin/sh
./configure --prefix=/usr/share --datadir=/usr/share/php \
--libdir=/usr/share --includedir=/usr/include \
--bindir=/usr/bin \
--with-config-file-path=/etc/php4/apache2 \
--with-config-file-scan=/etc/php4/apache2 \
--enable-mbstring --enable-mbregex \
--with-mysql \
--with-gd --enable-gd-imgstrttf --enable-gd-native-ttf \
--with-zlib-dir=/usr/lib \
--with-png-dir=/usr/lib --with-jpeg-dir=/usr/lib --with-xpm-dir=/usr/X11R6 \
--with-tiff-dir=/usr/lib --with-ttf-dir=/usr/lib \
--with-freetype-dir=/usr/lib \
--enable-ftp \
--enable-memory-limit \
--bindir=/usr/bin \
--enable-bcmath \
--enable-calendar \
--enable-ctype \
--with-ftp \
--enable-magic-quotes \
--enable-inline-optimization \
--with-bz2 \
--with-iconv
</pre>
</div>
</div>
</div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"> </td><td width="20%" align="center"><a accesskey="u" href="pt09.html">Up</a></td><td width="40%" align="right"> </td></tr><tr><td width="40%" align="left" valign="top"> </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> </td></tr></table></div></body></html>