127 lines
7.9 KiB
HTML
127 lines
7.9 KiB
HTML
<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>
|