source: general/prog/php.xml@ 39ffbd0

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 39ffbd0 was 39ffbd0, checked in by Fernando de Oliveira <fernando@…>, 8 years ago
  • GTK+-3.18.6: Recommend gobject-introspection-1.46.0.
  • ATK-2.18.0: Recommend gobject-introspection-1.46.0.
  • PHP-7.0.1: Update command explanations for MariaDB-10.1.10 or MySQL.
  • libxfce4ui-4.12.1: GTK+-3.18.6 is optional.
  • Update to sqlite-autoconf-3100000 (3.10.0).

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

  • Property mode set to 100644
File size: 20.5 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 "23aba67d57d53145becacb982ed498d5">
10 <!ENTITY php-size "11 MB">
11 <!ENTITY php-buildsize "564 MB (with the tests). Documentation adds 106 MB">
12 <!ENTITY php-time "6.2 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="&sources-anduin-http;/files/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>--disable-libxml</option>: This option
354 allows building PHP without <application>libxml2</application>
355 installed.
356 </para>
357
358 <para>
359 <option>--with-apxs2</option>: Instead of building the fastCGI process
360 manager, it is possible to build an <application>apache</application>
361 module. This has some performance penalty for heavy loaded servers,
362 but may be easier to set up. This switch is incompatible with the
363 <parameter>--enable-fpm</parameter> and
364 <parameter>--with-fpm-...</parameter> switches.
365 </para>
366
367 <para>
368 <option>--with-mysqli=/usr/bin/mysql_config</option>: This option
369 includes MySQLi support.
370 </para>
371
372 <para>
373 <option>--with-mysql-sock=/run/mysqld/mysqld.sock</option>: Location of
374 the MySQL unix socket pointer.
375 </para>
376
377 <para>
378 <option>--with-pdo-mysql=/usr</option>: This option includes PDO: MySQL
379 support.
380 </para>
381
382 </sect2>
383
384 <sect2 role="configuration">
385 <title>Configuring PHP</title>
386
387 <sect3 id="php-config">
388 <title>Config Files</title>
389
390 <para>
391 <filename>/etc/php.ini</filename>,
392 <filename>/etc/pear.conf</filename>,
393 <filename>/etc/php-fpm.conf</filename>, and
394 <filename>/etc/php-fpm.d/www.conf</filename>
395 </para>
396
397 <indexterm zone="php php-config">
398 <primary sortas="e-etc-php.ini">/etc/php.ini</primary>
399 </indexterm>
400
401 <indexterm zone="php php-config">
402 <primary sortas="e-etc-pear.conf">/etc/pear.conf</primary>
403 </indexterm>
404
405 <indexterm zone="php php-config">
406 <primary sortas="e-etc-php-fpm.d-www.conf">
407 /etc/php-fpm.d/www.conf</primary>
408 </indexterm>
409
410 <indexterm zone="php php-config">
411 <primary sortas="e-etc-php-fpm.conf">/etc/php-fpm.conf</primary>
412 </indexterm>
413
414 </sect3>
415
416 <sect3>
417 <title>Configuration Information</title>
418
419 <para>
420 Without the file <filename>/etc/php-fpm.d/www.conf</filename>,
421 the process manager does not start. However, it is the file
422 <filename>/etc/php-fpm.d/www.conf.default</filename>, that is
423 installed. To solve this, issue as the
424 <systemitem class="username">root</systemitem> user:
425 </para>
426
427<screen role="root"><userinput>cp -v /etc/php-fpm.d/www.conf.default /etc/php-fpm.d/www.conf</userinput></screen>
428
429 <para>
430 The file used as the default <filename>/etc/php.ini</filename>
431 configuration file is recommended by the <application>PHP</application>
432 development team. This file modifies the default behavior of
433 <application>PHP</application>. If no <filename>/etc/php.ini</filename>
434 is used, all configuration settings fall to the defaults. You should
435 review the comments in this file and ensure the changes are acceptable
436 in your particular environment.
437 </para>
438
439 <para>
440 You may have noticed the following from the output of the
441 <command>make install</command> command:
442 </para>
443
444<screen><computeroutput>You may want to add: /usr/lib/php to your php.ini include_path</computeroutput></screen>
445
446 <para>
447 If desired, add the entry using the following command as the
448 <systemitem class="username">root</systemitem> user:
449 </para>
450
451<screen role="root"><userinput>sed -i 's@php/includes"@&amp;\ninclude_path = ".:/usr/lib/php"@' \
452 /etc/php.ini</userinput></screen>
453
454 <para>
455 To enable fastCGI support in the <application>Apache</application>
456 web server, two LoadModule directives must be added to the
457 <filename>httpd.conf</filename> file. They are commented out, so just
458 issue the following command as
459 <systemitem class="username">root</systemitem> user:
460 </para>
461
462<screen role="root"><userinput>sed -i -e '/proxy_module/s/^#//' \
463 -e '/proxy_fcgi_module/s/^#//' \
464 /etc/httpd/httpd.conf</userinput></screen>
465
466 <para>
467 Those modules accept various <command>ProxyPass</command>
468 directives. One possibility is (as the
469 <systemitem class="username">root</systemitem> user):
470 </para>
471
472<screen role="root"><userinput>echo \
473'ProxyPassMatch ^/(.*\.php)$ fcgi://127.0.0.1:9000/srv/www/$1' >> \
474/etc/httpd/httpd.conf</userinput></screen>
475
476 <para>
477 Additionally, it may be useful to add an entry for
478 <filename>index.php</filename> to the DirectoryIndex directive of the
479 <filename>httpd.conf</filename> file. Lastly, adding a line to setup the
480 <filename class='extension'>.phps</filename> extension to show
481 highlighted <application>PHP</application> source may be
482 desirable:
483 </para>
484
485<screen><literal>AddType application/x-httpd-php-source .phps</literal></screen>
486
487 <para>
488 You'll need to restart the <application>Apache</application> web server
489 after making any modifications to the <filename>httpd.conf</filename>
490 file.
491 </para>
492
493 </sect3>
494
495 <sect3 id="php-init">
496 <title>Boot Script</title>
497
498 <para>
499 To automatically start the <command>php-fpm</command> daemon when the
500 system is rebooted, install the
501 <filename>/etc/rc.d/init.d/php</filename> bootscript from the
502 <xref linkend="bootscripts"/> package as the
503 <systemitem class="username">root</systemitem> user:
504 </para>
505
506 <indexterm zone="php php-init">
507 <primary sortas="f-php">php</primary>
508 </indexterm>
509
510<screen role="root"><userinput>make install-php</userinput></screen>
511 </sect3>
512
513 </sect2>
514
515 <sect2 role="content">
516 <title>Contents</title>
517
518 <segmentedlist>
519 <segtitle>Installed Programs</segtitle>
520 <segtitle>Installed Libraries</segtitle>
521 <segtitle>Installed Directories</segtitle>
522
523 <seglistitem>
524 <seg>pear, peardev, pecl, phar (symlink), phar.phar, php,
525 php-cgi, php-config, php-fpm, phpdbg, and phpize</seg>
526 <seg>dba.{so,a} and opcache.{so,a} at
527 /usr/lib/php/extensions/no-debug-non-zts-20151012</seg>
528 <seg>/etc/php-fpm.d, /usr/{include,lib,share}/php and
529 /usr/share/doc/php-&php-version;</seg>
530 </seglistitem>
531 </segmentedlist>
532
533 <variablelist>
534 <bridgehead renderas="sect3">Short Descriptions</bridgehead>
535 <?dbfo list-presentation="list"?>
536 <?dbhtml list-presentation="table"?>
537
538 <varlistentry id="php-prog">
539 <term><command>php</command></term>
540 <listitem>
541 <para>
542 is a command line interface that enables you to parse and
543 execute PHP code.
544 </para>
545 <indexterm zone="php php-prog">
546 <primary sortas="b-php">php</primary>
547 </indexterm>
548 </listitem>
549 </varlistentry>
550
551 <varlistentry id="pear">
552 <term><command>pear</command></term>
553 <listitem>
554 <para>
555 is the PHP Extension and Application Repository (PEAR) package
556 manager.
557 </para>
558 <indexterm zone="php pear">
559 <primary sortas="b-pear">pear</primary>
560 </indexterm>
561 </listitem>
562 </varlistentry>
563
564 <varlistentry id="php-fpm">
565 <term><command>php-fpm</command></term>
566 <listitem>
567 <para>
568 is the fastCGI process manager for PHP.
569 </para>
570 <indexterm zone="php php-fpm">
571 <primary sortas="b-php-fpm">php-fpm</primary>
572 </indexterm>
573 </listitem>
574 </varlistentry>
575
576 <varlistentry id="phpdbg">
577 <term><command>phpdbg</command></term>
578 <listitem>
579 <para>
580 is the interactive PHP debugger.
581 </para>
582 <indexterm zone="php phpdbg">
583 <primary sortas="b-phpdbg">phpdbg</primary>
584 </indexterm>
585 </listitem>
586 </varlistentry>
587
588 </variablelist>
589
590 </sect2>
591
592</sect1>
Note: See TracBrowser for help on using the repository browser.