1 | <?xml version="1.0" encoding="ISO-8859-1"?>
|
---|
2 | <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
|
---|
3 | "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
|
---|
4 | <!ENTITY % general-entities SYSTEM "../../general.ent">
|
---|
5 | %general-entities;
|
---|
6 |
|
---|
7 | <!ENTITY php-download-http "http://us2.php.net/distributions/php-&php-version;.tar.bz2">
|
---|
8 | <!ENTITY php-download-ftp "ftp://ftp.isu.edu.tw/pub/Unix/Web/PHP/distributions/php-&php-version;.tar.bz2">
|
---|
9 | <!ENTITY php-md5sum "46f500816125202c48a458d0133254a4">
|
---|
10 | <!ENTITY php-size "10.4 MB">
|
---|
11 | <!ENTITY php-buildsize "390 MB (includes installing all documentation)">
|
---|
12 | <!ENTITY php-time "3.4 SBU (additional 10.5 SBU to run the test suite)">
|
---|
13 | ]>
|
---|
14 |
|
---|
15 | <sect1 id="php" xreflabel="PHP-&php-version;">
|
---|
16 | <?dbhtml filename="php.html"?>
|
---|
17 |
|
---|
18 | <sect1info>
|
---|
19 | <othername>$LastChangedBy$</othername>
|
---|
20 | <date>$Date$</date>
|
---|
21 | </sect1info>
|
---|
22 |
|
---|
23 | <title>PHP-&php-version;</title>
|
---|
24 |
|
---|
25 | <indexterm zone="php">
|
---|
26 | <primary sortas="a-PHP">PHP</primary>
|
---|
27 | </indexterm>
|
---|
28 |
|
---|
29 | <sect2 role="package">
|
---|
30 | <title>Introduction to PHP</title>
|
---|
31 |
|
---|
32 | <para><application>PHP</application> is the PHP Hypertext Preprocessor.
|
---|
33 | Primarily used in dynamic web sites, it allows for programming code to be
|
---|
34 | directly embedded into the HTML markup.</para>
|
---|
35 |
|
---|
36 | <bridgehead renderas="sect3">Package Information</bridgehead>
|
---|
37 | <itemizedlist spacing="compact">
|
---|
38 | <listitem>
|
---|
39 | <para>Download (HTTP): <ulink url="&php-download-http;"/></para>
|
---|
40 | </listitem>
|
---|
41 | <listitem>
|
---|
42 | <para>Download (FTP): <ulink url="&php-download-ftp;"/></para>
|
---|
43 | </listitem>
|
---|
44 | <listitem>
|
---|
45 | <para>Download MD5 sum: &php-md5sum;</para>
|
---|
46 | </listitem>
|
---|
47 | <listitem>
|
---|
48 | <para>Download size: &php-size;</para>
|
---|
49 | </listitem>
|
---|
50 | <listitem>
|
---|
51 | <para>Estimated disk space required: &php-buildsize;</para>
|
---|
52 | </listitem>
|
---|
53 | <listitem>
|
---|
54 | <para>Estimated build time: &php-time;</para>
|
---|
55 | </listitem>
|
---|
56 | </itemizedlist>
|
---|
57 |
|
---|
58 | <bridgehead renderas="sect3">Additional Downloads</bridgehead>
|
---|
59 | <itemizedlist spacing="compact">
|
---|
60 | <!-- <listitem>
|
---|
61 | <para>Required patch for Berkeley DB: <ulink
|
---|
62 | url="&patch-root;/php-&php-version;-db43-1.patch"/></para>
|
---|
63 | </listitem> -->
|
---|
64 | <listitem>
|
---|
65 | <para>Pre-built documentation (optional): <ulink
|
---|
66 | url="http://www.php.net/download-docs.php"/></para>
|
---|
67 | </listitem>
|
---|
68 | </itemizedlist>
|
---|
69 |
|
---|
70 | <bridgehead renderas="sect3">PHP Dependencies</bridgehead>
|
---|
71 |
|
---|
72 | <bridgehead renderas="sect4">Required</bridgehead>
|
---|
73 | <para role="required"><xref linkend="apache"/></para>
|
---|
74 |
|
---|
75 | <bridgehead renderas="sect4">Recommended</bridgehead>
|
---|
76 | <para role="recommended"><xref linkend="libxml2"/></para>
|
---|
77 |
|
---|
78 | <bridgehead renderas="sect4">Optional System Utilities and Libraries</bridgehead>
|
---|
79 | <para role="optional"><xref linkend="libxslt"/>,
|
---|
80 | <!-- <xref linkend="gamin"/>, -->
|
---|
81 | <xref linkend="pcre"/>,
|
---|
82 | <xref linkend="aspell"/>,
|
---|
83 | <xref linkend="enchant"/>,
|
---|
84 | <!-- <xref linkend="pkgconfig"/>, -->
|
---|
85 | <xref linkend="recode"/>,
|
---|
86 | <xref linkend="expat"/> (deprecated alternative to <xref linkend="libxml2"/>),
|
---|
87 | <ulink url="http://www.ossp.org/pkg/lib/mm/">OSSP mm</ulink>,
|
---|
88 | <ulink url="http://www.net-snmp.org/">Net-SNMP</ulink>,
|
---|
89 | <xref linkend="pth"/>,
|
---|
90 | <ulink url="http://re2c.org/">re2c</ulink>,
|
---|
91 | <ulink url="http://xmlrpc-epi.sourceforge.net/main.php?t=php_about">XMLRPC-EPI</ulink>,
|
---|
92 | <ulink url="http://dmalloc.com/">Dmalloc</ulink>, and
|
---|
93 | an <xref linkend="server-mail"/> (that provides a
|
---|
94 | <command>sendmail</command> command)</para>
|
---|
95 |
|
---|
96 | <bridgehead renderas="sect4">Optional Graphics Utilities and Libraries</bridgehead>
|
---|
97 | <para role="optional"><xref linkend="libjpeg"/>,
|
---|
98 | <xref linkend="libtiff"/>,
|
---|
99 | <xref linkend="libpng"/>,
|
---|
100 | <xref linkend="libexif"/>,
|
---|
101 | <xref linkend="freetype2"/>,
|
---|
102 | <xref linkend="x-window-system"/>,
|
---|
103 | <ulink url="http://www.fastio.com/">ClibPDF</ulink>,
|
---|
104 | <ulink url="http://www.libgd.org/Main_Page">GD</ulink>,
|
---|
105 | <ulink url="http://www.sfr-fresh.com/linux/misc/t1lib">t1lib</ulink>, and
|
---|
106 | <ulink url="http://partners.adobe.com/asn/acrobat/forms.jsp">FDF Toolkit</ulink></para>
|
---|
107 |
|
---|
108 | <bridgehead renderas="sect4">Optional Web Utilities</bridgehead>
|
---|
109 | <para role="optional"><xref linkend="curl"/>,
|
---|
110 | <xref linkend="html-tidy"/>,
|
---|
111 | <ulink url="http://www.mnogosearch.org/">mnoGoSearch</ulink>,
|
---|
112 | <ulink url="http://www.hyperwave.com/">Hyperwave</ulink>,
|
---|
113 | <ulink url="http://www.roxen.com/products/webserver/">Roxen WebServer</ulink>,
|
---|
114 | <ulink url="http://caudium.net/">Caudium</ulink>, and
|
---|
115 | <ulink url="http://www.openwddx.org/">WDDX</ulink></para>
|
---|
116 |
|
---|
117 | <bridgehead renderas="sect4">Optional Data Management Utilities and Libraries</bridgehead>
|
---|
118 | <para role="optional"><xref linkend="openldap"/>,
|
---|
119 | <!-- <xref linkend="gdbm"/>, -->
|
---|
120 | <xref linkend="db"/>,
|
---|
121 | <xref linkend="mysql"/>,
|
---|
122 | <xref linkend="postgresql"/>,
|
---|
123 | <xref linkend="unixodbc"/>,
|
---|
124 | <xref linkend="sqlite"/>,
|
---|
125 | <ulink url="http://qdbm.sourceforge.net/">QDBM</ulink>,
|
---|
126 | <ulink url="http://cr.yp.to/cdb.html">cdb</ulink>,
|
---|
127 | <ulink url="http://www.hughes.com.au/products/msql/">Mini SQL</ulink>,
|
---|
128 | <ulink url="http://www.empress.com/">Empress</ulink>,
|
---|
129 | <ulink url="http://www.birdstep.com/">Birdstep</ulink>,
|
---|
130 | <ulink url="http://www.dbmaker.com/">DBMaker</ulink>,
|
---|
131 | <ulink url="http://www.softwareag.com/">Adabas</ulink>,
|
---|
132 | <ulink url="http://www.frontbase.com/">FrontBase</ulink>, and
|
---|
133 | <ulink url="http://www.mainstreetsoftworks.com/">Monetra</ulink></para>
|
---|
134 |
|
---|
135 | <para><application>PHP</application> also provides support for many
|
---|
136 | commercial database tools such as <application>Oracle</application>,
|
---|
137 | <application>SAP</application> and
|
---|
138 | <application>ODBC Router</application>.</para>
|
---|
139 |
|
---|
140 | <bridgehead renderas="sect4">Optional Security/Encryption Utilities and Libraries</bridgehead>
|
---|
141 | <para role="optional"><xref linkend="openssl"/>,
|
---|
142 | <xref linkend="cyrus-sasl"/>,
|
---|
143 | <xref linkend="mitkrb"/> or <xref linkend="heimdal"/>,
|
---|
144 | <ulink url="http://mcrypt.sourceforge.net/">libmcrypt</ulink>, and
|
---|
145 | <ulink url="http://mhash.sourceforge.net/">mhash</ulink></para>
|
---|
146 |
|
---|
147 | <para condition="html" role="usernotes">User Notes:
|
---|
148 | <ulink url="&blfs-wiki;/php"/></para>
|
---|
149 |
|
---|
150 | </sect2>
|
---|
151 |
|
---|
152 | <sect2 role="installation">
|
---|
153 | <title>Installation of PHP</title>
|
---|
154 |
|
---|
155 | <para>You can use <application>PHP</application> for server-side
|
---|
156 | scripting, command-line scripting or client-side GUI applications. This
|
---|
157 | book provides instructions for setting up <application>PHP</application>
|
---|
158 | for server-side scripting as it is the most common form.</para>
|
---|
159 |
|
---|
160 | <!-- Commenting this out for now as BDB is built in LFS
|
---|
161 |
|
---|
162 | <para>If you have <application>Berkeley DB</application> installed and
|
---|
163 | wish to utilize it, apply the following patch:</para>
|
---|
164 |
|
---|
165 | <screen><userinput>patch -Np1 -i ../php-&php-version;-db43-1.patch</userinput></screen>
|
---|
166 |
|
---|
167 | -->
|
---|
168 |
|
---|
169 | <note>
|
---|
170 | <para><application>PHP</application> has many more
|
---|
171 | <command>configure</command> options that will enable support for various
|
---|
172 | things. You can use <command>./configure --help</command> to see a full
|
---|
173 | list of the available options. Also, use of the
|
---|
174 | <ulink url="http://www.php.net/">PHP web site</ulink>
|
---|
175 | is highly recommended, as their online docs are very good. An example of
|
---|
176 | a <command>configure</command> command that utilizes many of the most
|
---|
177 | common dependencies can be found at <ulink
|
---|
178 | url="&files-anduin;/php_configure.txt"/>.
|
---|
179 | </para>
|
---|
180 |
|
---|
181 | <para>If, for whatever reason, you don't have <xref linkend="libxml2"/>
|
---|
182 | installed, you need to add <option>--disable-libxml</option> to the
|
---|
183 | <command>configure</command> command in the instructions below. Note that
|
---|
184 | this will prevent the <command>pear</command> command from being
|
---|
185 | built.</para>
|
---|
186 | </note>
|
---|
187 |
|
---|
188 | <!-- Commenting this out as libxml is a recommended dependency.
|
---|
189 | Current protocol in the book is to expect folks to have it
|
---|
190 | installed and the note above should take care of it.
|
---|
191 |
|
---|
192 | <para>Remove the <parameter>-disable-libxml</parameter> switch if you
|
---|
193 | have <xref linkend="libxml2"/> installed otherwise
|
---|
194 | <command>pear</command> will not be built.</para>
|
---|
195 | -->
|
---|
196 |
|
---|
197 | <para>Install <application>PHP</application> by
|
---|
198 | running the following commands:</para>
|
---|
199 |
|
---|
200 | <screen><userinput>./configure --prefix=/usr \
|
---|
201 | --sysconfdir=/etc \
|
---|
202 | --with-apxs2 \
|
---|
203 | --with-config-file-path=/etc \
|
---|
204 | --with-zlib \
|
---|
205 | --enable-bcmath \
|
---|
206 | --with-bz2 \
|
---|
207 | --enable-calendar \
|
---|
208 | --enable-dba=shared \
|
---|
209 | --with-gdbm \
|
---|
210 | --with-gmp \
|
---|
211 | --enable-ftp \
|
---|
212 | --with-gettext \
|
---|
213 | --enable-mbstring \
|
---|
214 | --with-readline &&
|
---|
215 | make</userinput></screen>
|
---|
216 |
|
---|
217 | <para>To test the results, issue: <command>make test</command>. Some of
|
---|
218 | the tests are known to fail.</para>
|
---|
219 |
|
---|
220 | <!--Three of
|
---|
221 | the (over 1600) tests are known to fail: an <command>iconv</command>
|
---|
222 | stream filter test (ext/iconv/tests/iconv_stream_filter.phpt) and two
|
---|
223 | MBString function overload tests (ext/mbstring/tests/overload01.phpt and
|
---|
224 | ext/mbstring/tests/overload02.phpt). Additionally, if you have the
|
---|
225 | <application>unixODBC</application> package installed and linked into the
|
---|
226 | build, you may see many failures related to it.</para> -->
|
---|
227 |
|
---|
228 | <para>Now, as the <systemitem class="username">root</systemitem> user:</para>
|
---|
229 |
|
---|
230 | <screen role="root"><userinput>make install &&
|
---|
231 | install -v -m644 php.ini-production /etc/php.ini &&
|
---|
232 |
|
---|
233 | install -v -m755 -d /usr/share/doc/php-&php-version; &&
|
---|
234 | install -v -m644 CODING_STANDARDS EXTENSIONS INSTALL NEWS \
|
---|
235 | README* TODO* UPGRADING php.gif \
|
---|
236 | /usr/share/doc/php-&php-version; &&
|
---|
237 | ln -v -s /usr/lib/php/doc/Archive_Tar/docs/Archive_Tar.txt \
|
---|
238 | /usr/share/doc/php-&php-version; &&
|
---|
239 | ln -v -s /usr/lib/php/doc/Structures_Graph/docs \
|
---|
240 | /usr/share/doc/php-&php-version;</userinput></screen>
|
---|
241 |
|
---|
242 | <para>The pre-built HTML documentation is packaged in two forms: a tarball
|
---|
243 | containing many individual files, useful for quick loading into your
|
---|
244 | browser, and one large individual file, which is useful for using the
|
---|
245 | search utility of your browser. If you downloaded either, or both, of the
|
---|
246 | documentation files, issue the following commands as the
|
---|
247 | <systemitem class='username'>root</systemitem> user to install them (note
|
---|
248 | these instructions assume English docs, modify the tarball names below if
|
---|
249 | necessary).</para>
|
---|
250 |
|
---|
251 | <para>For the <quote>Single HTML</quote> file:</para>
|
---|
252 |
|
---|
253 | <screen role="root"><userinput>install -v -m644 ../php_manual_en.html.gz \
|
---|
254 | /usr/share/doc/php-&php-version; &&
|
---|
255 | gunzip -v /usr/share/doc/php-&php-version;/php_manual_en.html.gz</userinput></screen>
|
---|
256 |
|
---|
257 | <para>For the <quote>Many HTML files</quote> tarball:</para>
|
---|
258 |
|
---|
259 | <screen role="root"><userinput>tar -xvf ../php_manual_en.tar.gz \
|
---|
260 | -C /usr/share/doc/php-&php-version; --no-same-user</userinput></screen>
|
---|
261 |
|
---|
262 | </sect2>
|
---|
263 |
|
---|
264 | <sect2 role="commands">
|
---|
265 | <title>Command Explanations</title>
|
---|
266 |
|
---|
267 | <!-- <para><command>sed -i '...' ext/dba/dba_db4.c</command>: This command is
|
---|
268 | used to fix an issue with the use of Berkeley DB >= 4.3.x.</para> -->
|
---|
269 |
|
---|
270 | <para><parameter>--with-apxs2</parameter>: This parameter
|
---|
271 | builds the Apache HTTPD 2.0 module.</para>
|
---|
272 |
|
---|
273 | <para><parameter>--with-config-file-path=/etc</parameter>: This parameter
|
---|
274 | makes <application>PHP</application> look for the
|
---|
275 | <filename>php.ini</filename> configuration file in
|
---|
276 | <filename class='directory'>/etc</filename>.</para>
|
---|
277 |
|
---|
278 | <para><parameter>--with-zlib</parameter>: This parameter adds
|
---|
279 | support for <application>Zlib</application> compression.</para>
|
---|
280 |
|
---|
281 | <para><parameter>--enable-bcmath</parameter>: Enables
|
---|
282 | <command>bc</command> style precision math functions.</para>
|
---|
283 |
|
---|
284 | <para><parameter>--with-bz2</parameter>: Adds support for
|
---|
285 | <application>Bzip2</application> compression functions.</para>
|
---|
286 |
|
---|
287 | <para><parameter>--enable-calendar</parameter>: This parameter
|
---|
288 | provides support for calendar conversion.</para>
|
---|
289 |
|
---|
290 | <para><parameter>--enable-dba=shared</parameter>: This parameter enables
|
---|
291 | support for database (dbm-style) abstraction layer functions.</para>
|
---|
292 |
|
---|
293 | <para><parameter>--enable-ftp</parameter>: This parameter
|
---|
294 | enables FTP functions.</para>
|
---|
295 |
|
---|
296 | <para><parameter>--with-gettext</parameter>: Enables functions
|
---|
297 | that use <application>Gettext</application> text translation.</para>
|
---|
298 |
|
---|
299 | <para><parameter>--enable-mbstring</parameter>: This parameter
|
---|
300 | enables multibyte string support.</para>
|
---|
301 |
|
---|
302 | <para><parameter>--with-readline</parameter>: This parameter
|
---|
303 | enables command line <application>Readline</application> support.</para>
|
---|
304 |
|
---|
305 | <para><parameter>--disable-libxml</parameter>: This parameter
|
---|
306 | allows building PHP without <application>libxml2</application>
|
---|
307 | installed.</para>
|
---|
308 |
|
---|
309 | </sect2>
|
---|
310 |
|
---|
311 | <sect2 role="configuration">
|
---|
312 | <title>Configuring PHP</title>
|
---|
313 |
|
---|
314 | <sect3 id="php-config">
|
---|
315 | <title>Config Files</title>
|
---|
316 |
|
---|
317 | <para><filename>/etc/php.ini</filename> and
|
---|
318 | <filename>/etc/pear.conf</filename></para>
|
---|
319 |
|
---|
320 | <indexterm zone="php php-config">
|
---|
321 | <primary sortas="e-etc-php.ini">/etc/php.ini</primary>
|
---|
322 | </indexterm>
|
---|
323 |
|
---|
324 | <indexterm zone="php php-config">
|
---|
325 | <primary sortas="e-etc-pear.conf">/etc/pear.conf</primary>
|
---|
326 | </indexterm>
|
---|
327 |
|
---|
328 | </sect3>
|
---|
329 |
|
---|
330 | <sect3>
|
---|
331 | <title>Configuration Information</title>
|
---|
332 |
|
---|
333 | <para>The file used as the default <filename>/etc/php.ini</filename>
|
---|
334 | configuration file is recommended by the <application>PHP</application>
|
---|
335 | development team. This file modifies the default behavior of
|
---|
336 | <application>PHP</application>. If no <filename>/etc/php.ini</filename>
|
---|
337 | is used, all configuration settings fall to the defaults. You should
|
---|
338 | review the comments in this file and ensure the changes are acceptable
|
---|
339 | in your particular environment.</para>
|
---|
340 |
|
---|
341 | <para>You may have noticed the following from the output of the
|
---|
342 | <command>make install</command> command:</para>
|
---|
343 |
|
---|
344 | <screen><computeroutput>You may want to add: /usr/lib/php to your php.ini include_path</computeroutput></screen>
|
---|
345 |
|
---|
346 | <para>If desired, add the entry using the following command as the
|
---|
347 | <systemitem class="username">root</systemitem> user:</para>
|
---|
348 |
|
---|
349 | <screen role="root"><userinput>sed -i 's@php/includes"@&\ninclude_path = ".:/usr/lib/php"@' \
|
---|
350 | /etc/php.ini</userinput></screen>
|
---|
351 |
|
---|
352 | <para>To enable PHP support in the <application>Apache</application>
|
---|
353 | web server, a new LoadModule (which should be handled automatically by the
|
---|
354 | <command>make install</command> command) and AddType directives
|
---|
355 | must be added to the <filename>httpd.conf</filename> file:</para>
|
---|
356 |
|
---|
357 | <screen><literal>LoadModule php5_module lib/apache/libphp5.so
|
---|
358 | AddType application/x-httpd-php .php</literal></screen>
|
---|
359 |
|
---|
360 | <para>Additionally, it can be useful to add an entry for
|
---|
361 | <filename>index.php</filename> to the DirectoryIndex directive of the
|
---|
362 | <filename>httpd.conf</filename> file. Lastly, adding a line to setup the
|
---|
363 | <filename class='extension'>.phps</filename> extension to show
|
---|
364 | highlighted <application>PHP</application> source may be
|
---|
365 | desirable:</para>
|
---|
366 |
|
---|
367 | <screen><literal>AddType application/x-httpd-php-source .phps</literal></screen>
|
---|
368 |
|
---|
369 | <para>You'll need to restart the <application>Apache</application> web server
|
---|
370 | after making any modifications to the <filename>httpd.conf</filename>
|
---|
371 | file.</para>
|
---|
372 |
|
---|
373 | </sect3>
|
---|
374 |
|
---|
375 | </sect2>
|
---|
376 |
|
---|
377 | <sect2 role="content">
|
---|
378 | <title>Contents</title>
|
---|
379 |
|
---|
380 | <segmentedlist>
|
---|
381 | <segtitle>Installed Programs</segtitle>
|
---|
382 | <segtitle>Installed Library</segtitle>
|
---|
383 | <segtitle>Installed Directories</segtitle>
|
---|
384 |
|
---|
385 | <seglistitem>
|
---|
386 | <seg>pear, peardev, pecl, php, php-config and phpize</seg>
|
---|
387 | <seg>libphp5.so Apache module</seg>
|
---|
388 | <seg>/usr/include/php, /usr/lib/php and
|
---|
389 | /usr/share/doc/php-&php-version;</seg>
|
---|
390 | </seglistitem>
|
---|
391 | </segmentedlist>
|
---|
392 |
|
---|
393 | <variablelist>
|
---|
394 | <bridgehead renderas="sect3">Short Descriptions</bridgehead>
|
---|
395 | <?dbfo list-presentation="list"?>
|
---|
396 | <?dbhtml list-presentation="table"?>
|
---|
397 |
|
---|
398 | <varlistentry id="php-prog">
|
---|
399 | <term><command>php</command></term>
|
---|
400 | <listitem>
|
---|
401 | <para>is a command line interface that enables you to parse and
|
---|
402 | execute PHP code.</para>
|
---|
403 | <indexterm zone="php php-prog">
|
---|
404 | <primary sortas="b-php">php</primary>
|
---|
405 | </indexterm>
|
---|
406 | </listitem>
|
---|
407 | </varlistentry>
|
---|
408 |
|
---|
409 | <varlistentry id="pear">
|
---|
410 | <term><command>pear</command></term>
|
---|
411 | <listitem>
|
---|
412 | <para>is the PHP Extension and Application
|
---|
413 | Repository (PEAR) package manager.</para>
|
---|
414 | <indexterm zone="php pear">
|
---|
415 | <primary sortas="b-pear">pear</primary>
|
---|
416 | </indexterm>
|
---|
417 | </listitem>
|
---|
418 | </varlistentry>
|
---|
419 |
|
---|
420 | </variablelist>
|
---|
421 |
|
---|
422 | </sect2>
|
---|
423 |
|
---|
424 | </sect1>
|
---|