source: general/prog/php.xml@ 44a4e0a

10.0 10.1 11.0 11.1 8.0 8.1 8.2 8.3 8.4 9.0 9.1 basic bdubbs/svn elogind lazarus perl-modules qt5new trunk upgradedb xry111/intltool xry111/test-20220226
Last change on this file since 44a4e0a was 44a4e0a, checked in by Bruce Dubbs <bdubbs@…>, 5 years ago

Update to php-7.1.2
Some tags.

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

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