source: general/prog/php.xml@ 5178bbf6

10.0 10.1 11.0 11.1 11.2 11.3 12.0 12.1 7.10 7.6 7.6-blfs 7.6-systemd 7.7 7.8 7.9 8.0 8.1 8.2 8.3 8.4 9.0 9.1 basic bdubbs/svn elogind gnome kde5-13430 kde5-14269 kde5-14686 kea ken/TL2024 ken/inkscape-core-mods ken/tuningfonts krejzi/svn lazarus lxqt nosym perl-modules plabs/newcss plabs/python-mods python3.11 qt5new rahul/power-profiles-daemon renodr/vulkan-addition systemd-11177 systemd-13485 trunk upgradedb xry111/intltool xry111/llvm18 xry111/soup3 xry111/test-20220226 xry111/xf86-video-removal
Last change on this file since 5178bbf6 was 5178bbf6, checked in by Pierre Labastie <pieere@…>, 10 years ago

Use the fastCGI process manager for PHP. Fixes ticket #4844

git-svn-id: svn://svn.linuxfromscratch.org/BLFS/trunk/BOOK@12909 af4574ff-66df-0310-9fd7-8a98e5e911e0

  • Property mode set to 100644
File size: 18.3 KB
Line 
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 "d608230c7890b6a0cc5b92e66e866226">
10 <!ENTITY php-size "13 MB">
11 <!ENTITY php-buildsize "357 MB">
12 <!ENTITY php-time "2.4 SBU (additional 2.1 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. It is also useful as a
35 general purpose scripting language.</para>
36
37 &lfs75_checked;
38
39 <bridgehead renderas="sect3">Package Information</bridgehead>
40 <itemizedlist spacing="compact">
41 <listitem>
42 <para>Download (HTTP): <ulink url="&php-download-http;"/></para>
43 </listitem>
44 <listitem>
45 <para>Download (FTP): <ulink url="&php-download-ftp;"/></para>
46 </listitem>
47 <listitem>
48 <para>Download MD5 sum: &php-md5sum;</para>
49 </listitem>
50 <listitem>
51 <para>Download size: &php-size;</para>
52 </listitem>
53 <listitem>
54 <para>Estimated disk space required: &php-buildsize;</para>
55 </listitem>
56 <listitem>
57 <para>Estimated build time: &php-time;</para>
58 </listitem>
59 </itemizedlist>
60
61 <bridgehead renderas="sect3">Additional Downloads</bridgehead>
62 <itemizedlist spacing="compact">
63 <listitem>
64 <para>Pre-built documentation (optional): <ulink
65 url="http://www.php.net/download-docs.php"/></para>
66 </listitem>
67 </itemizedlist>
68
69 <bridgehead renderas="sect3">PHP Dependencies</bridgehead>
70
71 <bridgehead renderas="sect4">Recommended</bridgehead>
72 <para role="recommended">
73 <xref linkend="apache"/> and
74 <xref linkend="libxml2"/>
75 </para>
76
77 <bridgehead renderas="sect4">Optional System Utilities and Libraries</bridgehead>
78 <para role="optional"><xref linkend="libxslt"/>,
79 <!-- <xref linkend="gamin"/>, -->
80 <xref linkend="pcre"/>,
81 <xref linkend="aspell"/>,
82 <xref linkend="enchant"/>,
83 <xref linkend="expat"/> (deprecated alternative to <xref linkend="libxml2"/>),
84 <ulink url="http://www.ossp.org/pkg/lib/mm/">OSSP mm</ulink>,
85 <ulink url="http://www.net-snmp.org/">Net-SNMP</ulink>,
86 <xref linkend="pth"/>,
87 <ulink url="http://re2c.org/">re2c</ulink>,
88 <ulink url="http://xmlrpc-epi.sourceforge.net/main.php?t=php_about">XMLRPC-EPI</ulink>,
89 <ulink url="http://dmalloc.com/">Dmalloc</ulink>, and
90 an <xref linkend="server-mail"/> (that provides a
91 <command>sendmail</command> command)</para>
92
93 <bridgehead renderas="sect4">Optional Graphics Utilities and Libraries</bridgehead>
94 <para role="optional"><xref linkend="libjpeg"/>,
95 <xref linkend="libtiff"/>,
96 <xref linkend="libpng"/>,
97 <xref linkend="libexif"/>,
98 <xref linkend="freetype2"/>,
99 <xref linkend="x-window-system"/>,
100 <ulink url="http://www.fastio.com/">ClibPDF</ulink>,
101 <ulink url="https://bitbucket.org/libgd/gd-libgd/downloads">GD</ulink>,
102 <ulink url="http://fossies.org/linux/misc/t1lib-5.1.2.tar.gz/">t1lib</ulink>, and
103 <ulink url="http://partners.adobe.com/asn/acrobat/forms.jsp">FDF Toolkit</ulink></para>
104
105 <bridgehead renderas="sect4">Optional Web Utilities</bridgehead>
106 <para role="optional"><xref linkend="curl"/>,
107 <xref linkend="html-tidy"/>,
108 <ulink url="http://www.mnogosearch.org/">mnoGoSearch</ulink>,
109 <ulink url="http://www.hyperwave.com/">Hyperwave</ulink>,
110 <ulink url="http://www.roxen.com/products/webserver/">Roxen WebServer</ulink>,
111 <ulink url="http://sourceforge.net/projects/caudium/">Caudium</ulink>, and
112 <ulink url="https://wddxnet.codeplex.com/">WDDX</ulink></para>
113
114 <bridgehead renderas="sect4">Optional Data Management Utilities and Libraries</bridgehead>
115 <para role="optional"><xref linkend="openldap"/>,
116 <!-- <xref linkend="gdbm"/>, -->
117 <xref linkend="db"/>,
118 <xref linkend="mariadb"/> or <xref linkend="mysql"/>,
119 <xref linkend="postgresql"/>,
120 <xref linkend="unixodbc"/>,
121 <xref linkend="sqlite"/>,
122 <ulink url="http://sourceforge.net/projects/qdbm">QDBM</ulink>,
123 <ulink url="http://cr.yp.to/cdb.html">cdb</ulink>,
124 <ulink url="http://www.hughes.com.au/products/msql/">Mini SQL</ulink>,
125 <ulink url="http://www.empress.com/">Empress</ulink>,
126 <ulink url="http://www.birdstep.com/">Birdstep</ulink>,
127 <ulink url="http://www.dbmaker.com/">DBMaker</ulink>,
128 <ulink url="http://www.softwareag.com/">Adabas</ulink>,
129 <ulink url="http://www.frontbase.com/">FrontBase</ulink>, and
130 <ulink url="http://www.mainstreetsoftworks.com/">Monetra</ulink></para>
131
132 <para><application>PHP</application> also provides support for many
133 commercial database tools such as <application>Oracle</application>,
134 <application>SAP</application> and
135 <application>ODBC Router</application>.</para>
136
137 <bridgehead renderas="sect4">Optional Security/Encryption Utilities and Libraries</bridgehead>
138 <para role="optional"><xref linkend="openssl"/>,
139 <xref linkend="cyrus-sasl"/>,
140 <xref linkend="mitkrb"/>,
141 <ulink url="http://mcrypt.sourceforge.net/">libmcrypt</ulink>, and
142 <ulink url="http://mhash.sourceforge.net/">mhash</ulink></para>
143
144 <para condition="html" role="usernotes">User Notes:
145 <ulink url="&blfs-wiki;/php"/></para>
146
147 </sect2>
148
149 <sect2 role="installation">
150 <title>Installation of PHP</title>
151
152 <para>You can use <application>PHP</application> for server-side
153 scripting, command-line scripting or client-side GUI applications. This
154 book provides instructions for setting up <application>PHP</application>
155 for server-side scripting as it is the most common form.</para>
156
157 <note>
158 <para><application>PHP</application> has many more
159 <command>configure</command> options that will enable support for various
160 things. You can use <command>./configure --help</command> to see a full
161 list of the available options. Also, use of the
162 <ulink url="http://www.php.net/">PHP web site</ulink>
163 is highly recommended, as their online docs are very good. An example of
164 a <command>configure</command> command that utilizes many of the most
165 common dependencies can be found at <ulink
166 url="&files-anduin;/php_configure.txt"/>.
167 </para>
168
169 <para>If, for whatever reason, you don't have <xref linkend="libxml2"/>
170 installed, you need to add <option>--disable-libxml</option> to the
171 <command>configure</command> command in the instructions below. Note that
172 this will prevent the <command>pear</command> command from being
173 built.</para>
174 </note>
175
176 <para>Install <application>PHP</application> by
177 running the following commands:</para>
178
179<screen><userinput>sed -i -e 's/2.6.5 2.7/&amp; 3.0/' configure &amp;&amp;
180./configure --prefix=/usr \
181 --sysconfdir=/etc \
182 --localstatedir=/var \
183 --datadir=/usr/share/php \
184 --mandir=/usr/share/man \
185 --enable-fpm \
186 --with-fpm-user=apache \
187 --with-fpm-group=apache \
188 --with-config-file-path=/etc \
189 --with-zlib \
190 --enable-bcmath \
191 --with-bz2 \
192 --enable-calendar \
193 --enable-dba=shared \
194 --with-gdbm \
195 --with-gmp \
196 --enable-ftp \
197 --with-gettext \
198 --enable-mbstring \
199 --with-readline &amp;&amp;
200make</userinput></screen>
201
202 <para>To test the results, issue: <command>make test</command>. A few
203 tests may fail.</para>
204
205 <para>Now, as the <systemitem class="username">root</systemitem> user:</para>
206
207<!-- dev note: make INSTALL_ROOT=<DESTDIR> install -->
208
209<screen role="root"><userinput>make install &amp;&amp;
210install -v -m644 php.ini-production /etc/php.ini &amp;&amp;
211mv -v /etc/php-fpm.conf{.default,} &amp;&amp;
212
213install -v -m755 -d /usr/share/doc/php-&php-version; &amp;&amp;
214install -v -m644 CODING_STANDARDS EXTENSIONS INSTALL NEWS README* UPGRADING* php.gif \
215 /usr/share/doc/php-&php-version; &amp;&amp;
216ln -v -sfn /usr/lib/php/doc/Archive_Tar/docs/Archive_Tar.txt \
217 /usr/share/doc/php-&php-version; &amp;&amp;
218ln -v -sfn /usr/lib/php/doc/Structures_Graph/docs \
219 /usr/share/doc/php-&php-version;</userinput></screen>
220
221 <para>The pre-built HTML documentation is packaged in two forms: a tarball
222 containing many individual files, useful for quick loading into your
223 browser, and one large individual file, which is useful for using the
224 search utility of your browser. If you downloaded either, or both, of the
225 documentation files, issue the following commands as the
226 <systemitem class='username'>root</systemitem> user to install them (note
227 these instructions assume English docs, modify the tarball names below if
228 necessary).</para>
229
230 <para>For the <quote>Single HTML</quote> file:</para>
231
232<screen role="root"><userinput>install -v -m644 ../php_manual_en.html.gz \
233 /usr/share/doc/php-&php-version; &amp;&amp;
234gunzip -v /usr/share/doc/php-&php-version;/php_manual_en.html.gz</userinput></screen>
235
236 <para>For the <quote>Many HTML files</quote> tarball:</para>
237
238<screen role="root"><userinput>tar -xvf ../php_manual_en.tar.gz \
239 -C /usr/share/doc/php-&php-version; --no-same-owner</userinput></screen>
240
241 </sect2>
242
243 <sect2 role="commands">
244 <title>Command Explanations</title>
245
246 <para><command>sed -i -e 's/2.6.5 2.7/&amp; 3.0/' configure</command>: Make
247 <filename>configure</filename> accept the version 3.0 of
248 <application>Bison</application> as a valid version.</para>
249
250 <para><parameter>--with-datadir=/usr/share/php</parameter>: This works
251 around a bug in the build machinery, which installs some data to a
252 wrong location.</para>
253
254 <para><parameter>--enable-fpm</parameter>: This parameter allows
255 building the fastCGI Process Manager.</para>
256
257 <para><parameter>--with-config-file-path=/etc</parameter>: This parameter
258 makes <application>PHP</application> look for the
259 <filename>php.ini</filename> configuration file in
260 <filename class='directory'>/etc</filename>.</para>
261
262 <para><parameter>--with-zlib</parameter>: This parameter adds
263 support for <application>Zlib</application> compression.</para>
264
265 <para><parameter>--enable-bcmath</parameter>: Enables
266 <command>bc</command> style precision math functions.</para>
267
268 <para><parameter>--with-bz2</parameter>: Adds support for
269 <application>Bzip2</application> compression functions.</para>
270
271 <para><parameter>--enable-calendar</parameter>: This parameter
272 provides support for calendar conversion.</para>
273
274 <para><parameter>--enable-dba=shared</parameter>: This parameter enables
275 support for database (dbm-style) abstraction layer functions.</para>
276
277 <para><parameter>--enable-ftp</parameter>: This parameter
278 enables FTP functions.</para>
279
280 <para><parameter>--with-gettext</parameter>: Enables functions
281 that use <application>Gettext</application> text translation.</para>
282
283 <para><parameter>--enable-mbstring</parameter>: This parameter
284 enables multibyte string support.</para>
285
286 <para><parameter>--with-readline</parameter>: This parameter
287 enables command line <application>Readline</application> support.</para>
288
289 <para><option>--disable-libxml</option>: This option
290 allows building PHP without <application>libxml2</application>
291 installed.</para>
292
293 <para><option>--with-apxs2</option>: Instead of building the fastCGI process
294 manager, it is possible to build an <application>apache</application> module.
295 This has some performance penalty for heavy loaded servers, but may be easier
296 to set up. This switch is incompatible with the
297 <parameter>--enable-fpm</parameter> and <parameter>--with-fpm-...</parameter>
298 switches.</para>
299
300 </sect2>
301
302 <sect2 role="configuration">
303 <title>Configuring PHP</title>
304
305 <sect3 id="php-config">
306 <title>Config Files</title>
307
308 <para><filename>/etc/php.ini</filename>,
309 <filename>/etc/pear.conf</filename> and
310 <filename>/etc/php-fpm.conf</filename></para>
311
312 <indexterm zone="php php-config">
313 <primary sortas="e-etc-php.ini">/etc/php.ini</primary>
314 </indexterm>
315
316 <indexterm zone="php php-config">
317 <primary sortas="e-etc-pear.conf">/etc/pear.conf</primary>
318 </indexterm>
319
320 <indexterm zone="php php-config">
321 <primary sortas="e-etc-php-fpm.conf">/etc/php-fpm.conf</primary>
322 </indexterm>
323
324 </sect3>
325
326 <sect3>
327 <title>Configuration Information</title>
328
329 <para>The file used as the default <filename>/etc/php.ini</filename>
330 configuration file is recommended by the <application>PHP</application>
331 development team. This file modifies the default behavior of
332 <application>PHP</application>. If no <filename>/etc/php.ini</filename>
333 is used, all configuration settings fall to the defaults. You should
334 review the comments in this file and ensure the changes are acceptable
335 in your particular environment.</para>
336
337 <para>You may have noticed the following from the output of the
338 <command>make install</command> command:</para>
339
340<screen><computeroutput>You may want to add: /usr/lib/php to your php.ini include_path</computeroutput></screen>
341
342 <para>If desired, add the entry using the following command as the
343 <systemitem class="username">root</systemitem> user:</para>
344
345<screen role="root"><userinput>sed -i 's@php/includes"@&amp;\ninclude_path = ".:/usr/lib/php"@' \
346 /etc/php.ini</userinput></screen>
347
348 <para>To enable fastCGI support in the <application>Apache</application>
349 web server, two LoadModule directives must be added to the
350 <filename>httpd.conf</filename> file. They are commented out, so just issue the
351 following command as <systemitem class="username">root</systemitem> user:</para>
352
353<screen role="root"><userinput>sed -i -e '/proxy_module/s/^#//' \
354 -e '/proxy_fgci_module/s/^#//' \
355 /etc/httpd/httpd.conf</userinput></screen>
356
357 <para>Those modules accept various <command>ProxyPass</command>
358 directives. One possibility is (as the
359 <systemitem class="username">root</systemitem> user):</para>
360
361<screen role="root"><userinput>echo \
362ProxyPassMatch ^/(.*\.php)$ fcgi://127.0.0.1:9000/srv/www/$1 >> \
363/etc/httpd/httpd.conf</userinput></screen>
364
365 <para>Additionally, it may be useful to add an entry for
366 <filename>index.php</filename> to the DirectoryIndex directive of the
367 <filename>httpd.conf</filename> file. Lastly, adding a line to setup the
368 <filename class='extension'>.phps</filename> extension to show
369 highlighted <application>PHP</application> source may be
370 desirable:</para>
371
372<screen><literal>AddType application/x-httpd-php-source .phps</literal></screen>
373
374 <para>You'll need to restart the <application>Apache</application> web server
375 after making any modifications to the <filename>httpd.conf</filename>
376 file.</para>
377
378 </sect3>
379
380 <sect3 id="php-init">
381 <title>Boot Script</title>
382
383 <para>
384 To automatically start the <command>php-fpm</command> daemon when the
385 system is rebooted, install the
386 <filename>/etc/rc.d/init.d/php</filename> bootscript from the
387 <xref linkend="bootscripts"/> package as the
388 <systemitem class="username">root</systemitem> user:
389 </para>
390
391 <indexterm zone="php php-init">
392 <primary sortas="f-php">php</primary>
393 </indexterm>
394
395<screen role="root"><userinput>make install-php</userinput></screen>
396 </sect3>
397
398 </sect2>
399
400 <sect2 role="content">
401 <title>Contents</title>
402
403 <segmentedlist>
404 <segtitle>Installed Programs</segtitle>
405 <segtitle>Installed Library</segtitle>
406 <segtitle>Installed Directories</segtitle>
407
408 <seglistitem>
409 <seg>pear, peardev, pecl, phar (symlink), phar.phar,
410 php, php-cgi, php-config, php-fpm, and phpize</seg>
411 <seg>dba.so and opcache.so in
412 /usr/lib/php/extensions/no-debug-non-zts-20121212/</seg>
413 <seg>/usr/include/php, /usr/lib/php, /usr/share/php and
414 /usr/share/doc/php-&php-version;</seg>
415 </seglistitem>
416 </segmentedlist>
417
418 <variablelist>
419 <bridgehead renderas="sect3">Short Descriptions</bridgehead>
420 <?dbfo list-presentation="list"?>
421 <?dbhtml list-presentation="table"?>
422
423 <varlistentry id="php-prog">
424 <term><command>php</command></term>
425 <listitem>
426 <para>is a command line interface that enables you to parse and
427 execute PHP code.</para>
428 <indexterm zone="php php-prog">
429 <primary sortas="b-php">php</primary>
430 </indexterm>
431 </listitem>
432 </varlistentry>
433
434 <varlistentry id="pear">
435 <term><command>pear</command></term>
436 <listitem>
437 <para>is the PHP Extension and Application
438 Repository (PEAR) package manager.</para>
439 <indexterm zone="php pear">
440 <primary sortas="b-pear">pear</primary>
441 </indexterm>
442 </listitem>
443 </varlistentry>
444
445 <varlistentry id="php-fpm">
446 <term><command>php-fpm</command></term>
447 <listitem>
448 <para>is the fastCGI process manager for PHP.</para>
449 <indexterm zone="php php-fpm">
450 <primary sortas="b-php-fpm">php-fpm</primary>
451 </indexterm>
452 </listitem>
453 </varlistentry>
454
455 </variablelist>
456
457 </sect2>
458
459</sect1>
Note: See TracBrowser for help on using the repository browser.