source: general/prog/php.xml@ bd86aa8

10.0 10.1 11.0 11.1 11.2 11.3 12.0 12.1 7.10 7.9 8.0 8.1 8.2 8.3 8.4 9.0 9.1 basic bdubbs/svn elogind kea ken/TL2024 ken/inkscape-core-mods ken/tuningfonts lazarus lxqt nosym perl-modules plabs/newcss plabs/python-mods python3.11 qt5new rahul/power-profiles-daemon renodr/vulkan-addition trunk upgradedb xry111/intltool xry111/llvm18 xry111/soup3 xry111/test-20220226 xry111/xf86-video-removal
Last change on this file since bd86aa8 was bd86aa8, checked in by Fernando de Oliveira <fernando@…>, 8 years ago
  • Update to php-7.0.3.
  • Update to gnutls-3.4.9.
  • Update to Regexp-Common-2016020301 (perl module).
  • Update to mercurial-3.7.1.

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

  • Property mode set to 100644
File size: 21.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-download-ftp " ">
10 <!ENTITY php-md5sum "3c5d2b5b392b78fa92c48822e25ccb56">
11 <!ENTITY php-size "11 MB">
12 <!ENTITY php-buildsize "565 MB (with the tests). Documentation adds 100 MB">
13 <!ENTITY php-time "6.2 SBU (with the 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 &lfs78_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/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-html"/>,
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"/>,
138 <xref linkend="mariadb"/> or <ulink url="http://www.mysql.com/">MySQL</ulink>,
139 <xref linkend="openldap"/>,
140 <xref linkend="postgresql"/>,
141 <xref linkend="sqlite"/>,
142 <xref linkend="unixodbc"/>,
143 <ulink url="http://www.softwareag.com/">Adabas</ulink>,
144 <ulink url="http://www.birdstep.com/">Birdstep</ulink>,
145 <ulink url="http://cr.yp.to/cdb.html">cdb</ulink>,
146 <ulink url="http://www.dbmaker.com/">DBMaker</ulink>,
147 <ulink url="http://www.empress.com/">Empress</ulink>,
148 <ulink url="http://www.frontbase.com/cgi-bin/WebObjects/FBWebSite">FrontBase</ulink>,
149 <ulink url="http://www.hughes.com.au/products/msql/">Mini SQL</ulink>,
150 <ulink url="http://www.monetra.com/">Monetra</ulink>, and
151 <ulink url="http://sourceforge.net/projects/qdbm">QDBM</ulink>
152 </para>
153
154 <para>
155 <application>PHP</application> also provides support for many
156 commercial database tools such as <application>Oracle</application>,
157 <application>SAP</application> and
158 <application>ODBC Router</application>.
159 </para>
160
161 <bridgehead renderas="sect4">Optional Security/Encryption Utilities and Libraries</bridgehead>
162 <para role="optional">
163 <xref linkend="openssl"/>,
164 <xref linkend="cyrus-sasl"/>,
165 <xref linkend="mitkrb"/>,
166 <ulink url="http://mcrypt.sourceforge.net/">libmcrypt</ulink>, and
167 <ulink url="http://mhash.sourceforge.net/">mhash</ulink>
168 </para>
169
170 <para condition="html" role="usernotes">
171 User Notes: <ulink url="&blfs-wiki;/php"/>
172 </para>
173
174 </sect2>
175
176 <sect2 role="installation">
177 <title>Installation of PHP</title>
178
179 <para>
180 You can use <application>PHP</application> for server-side
181 scripting, command-line scripting or client-side GUI applications. This
182 book provides instructions for setting up <application>PHP</application>
183 for server-side scripting as it is the most common form.
184 </para>
185
186 <note>
187 <para>
188 <application>PHP</application> has many more
189 <command>configure</command> options that will enable support for
190 various things. You can use <command>./configure --help</command> to
191 see a full list of the available options. Also, use of the
192 <ulink url="http://www.php.net/">PHP web site</ulink>
193 is highly recommended, as their online docs are very good. An example
194 of a <command>configure</command> command that utilizes many of the
195 most common dependencies can be found at <ulink
196 url="&sources-anduin-http;/files/php_configure.txt"/>.
197 </para>
198
199 <para>
200 If, for whatever reason, you don't have <xref linkend="libxml2"/>
201 installed, you need to add <option>--disable-libxml</option> to the
202 <command>configure</command> command in the instructions below. Note
203 that this will prevent the <command>pear</command> command from being
204 built.
205 </para>
206 </note>
207
208 <para>
209 If you wish to build <application>PHP</application> with the
210 <application>tidy-html5</application> library, due to API changes, in the
211 <application>PHP</application> source, <filename>buffio.h</filename>
212 header needs to be changed to <filename>tidybuffio.h</filename> in the
213 file <filename>ext/tidy/tidy.c</filename>:
214 </para>
215
216<screen><userinput>sed -i 's/buffio.h/tidy&amp;/' ext/tidy/*.c</userinput></screen>
217
218 <para>
219 Install <application>PHP</application> by running the following commands:
220 </para>
221
222<screen><userinput>./configure --prefix=/usr \
223 --sysconfdir=/etc \
224 --localstatedir=/var \
225 --datadir=/usr/share/php \
226 --mandir=/usr/share/man \
227 --enable-fpm \
228 --with-fpm-user=apache \
229 --with-fpm-group=apache \
230 --with-config-file-path=/etc \
231 --with-zlib \
232 --enable-bcmath \
233 --with-bz2 \
234 --enable-calendar \
235 --enable-dba=shared \
236 --with-gdbm \
237 --with-gmp \
238 --enable-ftp \
239 --with-gettext \
240 --enable-mbstring \
241 --with-readline &amp;&amp;
242make</userinput></screen>
243
244 <para>
245 To test the results, issue: <command>make test</command>. A few
246 tests may fail, in which case you are asked whether you want to send
247 the report to the PHP developpers. If you want to automate the test,
248 you may prefix the command with <command>yes "n" | </command>.
249 </para>
250
251 <para>
252 Now, as the <systemitem class="username">root</systemitem> user:
253 </para>
254
255<!-- dev note: make INSTALL_ROOT=<DESTDIR> install -->
256
257<screen role="root"><userinput>make install &amp;&amp;
258install -v -m644 php.ini-production /etc/php.ini &amp;&amp;
259mv -v /etc/php-fpm.conf{.default,} &amp;&amp;
260
261install -v -m755 -d /usr/share/doc/php-&php-version; &amp;&amp;
262install -v -m644 CODING_STANDARDS EXTENSIONS INSTALL NEWS README* UPGRADING* php.gif \
263 /usr/share/doc/php-&php-version; &amp;&amp;
264ln -v -sfn /usr/lib/php/doc/Archive_Tar/docs/Archive_Tar.txt \
265 /usr/share/doc/php-&php-version; &amp;&amp;
266ln -v -sfn /usr/lib/php/doc/Structures_Graph/docs \
267 /usr/share/doc/php-&php-version;</userinput></screen>
268
269 <para>
270 The pre-built HTML documentation is packaged in two forms: a tarball
271 containing many individual files, useful for quick loading into your
272 browser, and one large individual file, which is useful for using the
273 search utility of your browser. If you downloaded either, or both, of the
274 documentation files, issue the following commands as the
275 <systemitem class='username'>root</systemitem> user to install them (note
276 these instructions assume English docs, modify the tarball names below if
277 necessary).
278 </para>
279
280 <para>
281 For the <quote>Single HTML</quote> file:
282 </para>
283
284<screen role="root"><userinput>install -v -m644 ../php_manual_en.html.gz \
285 /usr/share/doc/php-&php-version; &amp;&amp;
286gunzip -v /usr/share/doc/php-&php-version;/php_manual_en.html.gz</userinput></screen>
287
288 <para>
289 For the <quote>Many HTML files</quote> tarball:
290 </para>
291
292<screen role="root"><userinput>tar -xvf ../php_manual_en.tar.gz \
293 -C /usr/share/doc/php-&php-version; --no-same-owner</userinput></screen>
294
295 </sect2>
296
297 <sect2 role="commands">
298 <title>Command Explanations</title>
299
300 <para>
301 <parameter>--with-datadir=/usr/share/php</parameter>: This works
302 around a bug in the build machinery, which installs some data to a
303 wrong location.
304 </para>
305
306 <para>
307 <parameter>--enable-fpm</parameter>: This parameter allows
308 building the fastCGI Process Manager.
309 </para>
310
311 <para>
312 <parameter>--with-config-file-path=/etc</parameter>: This parameter
313 makes <application>PHP</application> look for the
314 <filename>php.ini</filename> configuration file in
315 <filename class='directory'>/etc</filename>.
316 </para>
317
318 <para>
319 <parameter>--with-zlib</parameter>: This parameter adds
320 support for <application>Zlib</application> compression.
321 </para>
322
323 <para>
324 <parameter>--enable-bcmath</parameter>: Enables
325 <command>bc</command> style precision math functions.
326 </para>
327
328 <para>
329 <parameter>--with-bz2</parameter>: Adds support for
330 <application>Bzip2</application> compression functions.
331 </para>
332
333 <para>
334 <parameter>--enable-calendar</parameter>: This parameter
335 provides support for calendar conversion.
336 </para>
337
338 <para>
339 <parameter>--enable-dba=shared</parameter>: This parameter enables
340 support for database (dbm-style) abstraction layer functions.
341 </para>
342
343 <para>
344 <parameter>--enable-ftp</parameter>: This parameter
345 enables FTP functions.
346 </para>
347
348 <para>
349 <parameter>--with-gettext</parameter>: Enables functions
350 that use <application>Gettext</application> text translation.
351 </para>
352
353 <para>
354 <parameter>--enable-mbstring</parameter>: This parameter
355 enables multibyte string support.
356 </para>
357
358 <para>
359 <parameter>--with-readline</parameter>: This parameter
360 enables command line <application>Readline</application> support.
361 </para>
362
363 <para>
364 <option>--disable-libxml</option>: This option
365 allows building PHP without <application>libxml2</application>
366 installed.
367 </para>
368
369 <para>
370 <option>--with-apxs2</option>: Instead of building the fastCGI process
371 manager, it is possible to build an <application>apache</application>
372 module. This has some performance penalty for heavy loaded servers,
373 but may be easier to set up. This switch is incompatible with the
374 <parameter>--enable-fpm</parameter> and
375 <parameter>--with-fpm-...</parameter> switches.
376 </para>
377
378 <para>
379 <option>--with-mysqli=shared</option>: This option includes MySQLi
380 support.
381 </para>
382
383 <para>
384 <option>--with-mysql-sock=/run/mysqld/mysqld.sock</option>: Location of
385 the MySQL unix socket pointer.
386 </para>
387
388 <para>
389 <option>--with-pdo-mysql=shared</option>: This option includes PDO:
390 MySQL support.
391 </para>
392
393 <para>
394 <option>--with-tidy=shared</option>: This option includes tidy library
395 support.
396 </para>
397
398 </sect2>
399
400 <sect2 role="configuration">
401 <title>Configuring PHP</title>
402
403 <sect3 id="php-config">
404 <title>Config Files</title>
405
406 <para>
407 <filename>/etc/php.ini</filename>,
408 <filename>/etc/pear.conf</filename>,
409 <filename>/etc/php-fpm.conf</filename>, and
410 <filename>/etc/php-fpm.d/www.conf</filename>
411 </para>
412
413 <indexterm zone="php php-config">
414 <primary sortas="e-etc-php.ini">/etc/php.ini</primary>
415 </indexterm>
416
417 <indexterm zone="php php-config">
418 <primary sortas="e-etc-pear.conf">/etc/pear.conf</primary>
419 </indexterm>
420
421 <indexterm zone="php php-config">
422 <primary sortas="e-etc-php-fpm.d-www.conf">
423 /etc/php-fpm.d/www.conf</primary>
424 </indexterm>
425
426 <indexterm zone="php php-config">
427 <primary sortas="e-etc-php-fpm.conf">/etc/php-fpm.conf</primary>
428 </indexterm>
429
430 </sect3>
431
432 <sect3>
433 <title>Configuration Information</title>
434
435 <para>
436 Without the file <filename>/etc/php-fpm.d/www.conf</filename>,
437 the process manager does not start. However, it is the file
438 <filename>/etc/php-fpm.d/www.conf.default</filename>, that is
439 installed. To solve this, issue as the
440 <systemitem class="username">root</systemitem> user:
441 </para>
442
443<screen role="root"><userinput>cp -v /etc/php-fpm.d/www.conf.default /etc/php-fpm.d/www.conf</userinput></screen>
444
445 <para>
446 The file used as the default <filename>/etc/php.ini</filename>
447 configuration file is recommended by the <application>PHP</application>
448 development team. This file modifies the default behavior of
449 <application>PHP</application>. If no <filename>/etc/php.ini</filename>
450 is used, all configuration settings fall to the defaults. You should
451 review the comments in this file and ensure the changes are acceptable
452 in your particular environment.
453 </para>
454
455 <para>
456 You may have noticed the following from the output of the
457 <command>make install</command> command:
458 </para>
459
460<screen><computeroutput>You may want to add: /usr/lib/php to your php.ini include_path</computeroutput></screen>
461
462 <para>
463 If desired, add the entry using the following command as the
464 <systemitem class="username">root</systemitem> user:
465 </para>
466
467<screen role="root"><userinput>sed -i 's@php/includes"@&amp;\ninclude_path = ".:/usr/lib/php"@' \
468 /etc/php.ini</userinput></screen>
469
470 <para>
471 To enable fastCGI support in the <application>Apache</application>
472 web server, two LoadModule directives must be added to the
473 <filename>httpd.conf</filename> file. They are commented out, so just
474 issue the following command as
475 <systemitem class="username">root</systemitem> user:
476 </para>
477
478<screen role="root"><userinput>sed -i -e '/proxy_module/s/^#//' \
479 -e '/proxy_fcgi_module/s/^#//' \
480 /etc/httpd/httpd.conf</userinput></screen>
481
482 <para>
483 Those modules accept various <command>ProxyPass</command>
484 directives. One possibility is (as the
485 <systemitem class="username">root</systemitem> user):
486 </para>
487
488<screen role="root"><userinput>echo \
489'ProxyPassMatch ^/(.*\.php)$ fcgi://127.0.0.1:9000/srv/www/$1' >> \
490/etc/httpd/httpd.conf</userinput></screen>
491
492 <para>
493 Additionally, it may be useful to add an entry for
494 <filename>index.php</filename> to the DirectoryIndex directive of the
495 <filename>httpd.conf</filename> file. Lastly, adding a line to setup the
496 <filename class='extension'>.phps</filename> extension to show
497 highlighted <application>PHP</application> source may be
498 desirable:
499 </para>
500
501<screen><literal>AddType application/x-httpd-php-source .phps</literal></screen>
502
503 <para>
504 You'll need to restart the <application>Apache</application> web server
505 after making any modifications to the <filename>httpd.conf</filename>
506 file.
507 </para>
508
509 </sect3>
510
511 <sect3 id="php-init">
512 <title>Boot Script</title>
513
514 <para>
515 To automatically start the <command>php-fpm</command> daemon when the
516 system is rebooted, install the
517 <filename>/etc/rc.d/init.d/php</filename> bootscript from the
518 <xref linkend="bootscripts"/> package as the
519 <systemitem class="username">root</systemitem> user:
520 </para>
521
522 <indexterm zone="php php-init">
523 <primary sortas="f-php">php</primary>
524 </indexterm>
525
526<screen role="root"><userinput>make install-php</userinput></screen>
527 </sect3>
528
529 </sect2>
530
531 <sect2 role="content">
532 <title>Contents</title>
533
534 <segmentedlist>
535 <segtitle>Installed Programs</segtitle>
536 <segtitle>Installed Libraries</segtitle>
537 <segtitle>Installed Directories</segtitle>
538
539 <seglistitem>
540 <seg>pear, peardev, pecl, phar (symlink), phar.phar, php,
541 php-cgi, php-config, php-fpm, phpdbg, and phpize</seg>
542 <seg>dba.{so,a} and opcache.{so,a} at
543 /usr/lib/php/extensions/no-debug-non-zts-20151012</seg>
544 <seg>/etc/php-fpm.d, /usr/{include,lib,share}/php and
545 /usr/share/doc/php-&php-version;</seg>
546 </seglistitem>
547 </segmentedlist>
548
549 <variablelist>
550 <bridgehead renderas="sect3">Short Descriptions</bridgehead>
551 <?dbfo list-presentation="list"?>
552 <?dbhtml list-presentation="table"?>
553
554 <varlistentry id="php-prog">
555 <term><command>php</command></term>
556 <listitem>
557 <para>
558 is a command line interface that enables you to parse and
559 execute PHP code.
560 </para>
561 <indexterm zone="php php-prog">
562 <primary sortas="b-php">php</primary>
563 </indexterm>
564 </listitem>
565 </varlistentry>
566
567 <varlistentry id="pear">
568 <term><command>pear</command></term>
569 <listitem>
570 <para>
571 is the PHP Extension and Application Repository (PEAR) package
572 manager.
573 </para>
574 <indexterm zone="php pear">
575 <primary sortas="b-pear">pear</primary>
576 </indexterm>
577 </listitem>
578 </varlistentry>
579
580 <varlistentry id="php-fpm">
581 <term><command>php-fpm</command></term>
582 <listitem>
583 <para>
584 is the fastCGI process manager for PHP.
585 </para>
586 <indexterm zone="php php-fpm">
587 <primary sortas="b-php-fpm">php-fpm</primary>
588 </indexterm>
589 </listitem>
590 </varlistentry>
591
592 <varlistentry id="phpdbg">
593 <term><command>phpdbg</command></term>
594 <listitem>
595 <para>
596 is the interactive PHP debugger.
597 </para>
598 <indexterm zone="php phpdbg">
599 <primary sortas="b-phpdbg">phpdbg</primary>
600 </indexterm>
601 </listitem>
602 </varlistentry>
603
604 </variablelist>
605
606 </sect2>
607
608</sect1>
Note: See TracBrowser for help on using the repository browser.