source: general/prog/php.xml@ 862d4ce

10.0 10.1 11.0 11.1 7.10 7.9 8.0 8.1 8.2 8.3 8.4 9.0 9.1 basic bdubbs/svn elogind lazarus nosym perl-modules qt5new trunk upgradedb xry111/intltool xry111/test-20220226
Last change on this file since 862d4ce was 862d4ce, checked in by Pierre Labastie <pieere@…>, 7 years ago

Update to PHP-5.6.14, ticket 6990

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

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