source: general/prog/php.xml@ 949e158

10.0 10.1 11.0 11.1 11.2 11.3 12.0 12.1 7.10 7.6 7.6-blfs 7.6-systemd 7.7 7.8 7.9 8.0 8.1 8.2 8.3 8.4 9.0 9.1 basic bdubbs/svn elogind gnome kde5-13430 kde5-14269 kde5-14686 kea ken/TL2024 ken/inkscape-core-mods ken/tuningfonts krejzi/svn lazarus lxqt nosym perl-modules plabs/newcss plabs/python-mods python3.11 qt5new rahul/power-profiles-daemon renodr/vulkan-addition systemd-11177 systemd-13485 trunk upgradedb xry111/intltool xry111/llvm18 xry111/soup3 xry111/test-20220226 xry111/xf86-video-removal
Last change on this file since 949e158 was 5e0662d, checked in by Bruce Dubbs <bdubbs@…>, 10 years ago

Updated to mariadb-10.0.10.
Archived mysql.

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

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