source: general/prog/php.xml@ 56605b9

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 56605b9 was 56605b9, checked in by Bruce Dubbs <bdubbs@…>, 10 years ago

Remove XML::Parser from perl modules
Archive acl, attr, intltool, expat, gperf
Synchronize libcap with LFS.

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

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