source: general/prog/php.xml@ 514797f

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 514797f was 514797f, checked in by Fernando de Oliveira <fernando@…>, 8 years ago
  • Update to poppler-0.39.0.
  • Update to ruby-2.2.4.
  • Update to samba-4.3.3.
  • Update to libreoffice-5.0.4 (libreoffice-5.0.4.2).
  • Update to boost_1_60_0.
  • Update to libcroco-0.6.11.
  • Update to Archive-Zip-1.56 (perl module).
  • Update to php-7.0.1.
  • Update to cups-filters-1.5.0.

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

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