PHP is the PHP Hypertext Preprocessor. Primarily used in dynamic web sites, it allows for programming code to be directly embedded into the HTML markup. It is also useful as a general purpose scripting language.
This package is known to build and work properly using an LFS-7.7 platform.
Download (HTTP): http://www.php.net/distributions/php-5.6.6.tar.xz
Download (FTP): ftp://ftp.isu.edu.tw/pub/Unix/Web/PHP/distributions/php-5.6.6.tar.xz
Download MD5 sum: ed0c9ad2419fffde1d8c03a2d8164179
Download size: 11 MB
Estimated disk space required: 446 MB (additional 1 MB to run the test suite and 102 MB for documentation)
Estimated build time: 4.1 SBU (additional 2.3 SBU to run the test suite)
Pre-built documentation (optional): http://www.php.net/download-docs.php
Apache-2.4.12 and libxml2-2.9.2
libxslt-1.1.28, PCRE-8.36, Aspell-0.60.6.1, enchant-1.6.0, Pth-2.0.7, an MTA (that provides a sendmail command) OSSP mm, Net-SNMP, re2c, XMLRPC-EPI, and Dmalloc
libjpeg-turbo-1.4.0, LibTIFF-4.0.3, libpng-1.6.16, libexif-0.6.21, FreeType-2.5.5, X Window System, ClibPDF, GD, t1lib, and FDF Toolkit
cURL-7.40.0, HTML Tidy-cvs_20101110, mnoGoSearch, Hyperwave, Roxen WebServer, Caudium, and WDDX
OpenLDAP-2.4.40, Berkeley DB-6.1.19, MariaDB-10.0.16 or MySQL, PostgreSQL-9.4.1, unixODBC-2.3.2, SQLite-3.8.8.2, QDBM, cdb, Mini SQL, Empress, Birdstep, DBMaker, Adabas, FrontBase, and Monetra
PHP also provides support for many commercial database tools such as Oracle, SAP and ODBC Router.
OpenSSL-1.0.2, Cyrus SASL-2.1.26, MIT Kerberos V5-1.13.1, libmcrypt, and mhash
User Notes: http://wiki.linuxfromscratch.org/blfs/wiki/php
You can use PHP for server-side scripting, command-line scripting or client-side GUI applications. This book provides instructions for setting up PHP for server-side scripting as it is the most common form.
PHP has many more configure options that will enable support for various things. You can use ./configure --help to see a full list of the available options. Also, use of the PHP web site is highly recommended, as their online docs are very good. An example of a configure command that utilizes many of the most common dependencies can be found at http://anduin.linuxfromscratch.org/files/BLFS/svn/php_configure.txt.
If, for whatever reason, you don't have libxml2-2.9.2 installed,
you need to add --disable-libxml
to
the configure
command in the instructions below. Note that this will prevent
the pear command
from being built.
Install PHP by running the following commands:
./configure --prefix=/usr \ --sysconfdir=/etc \ --localstatedir=/var \ --datadir=/usr/share/php \ --mandir=/usr/share/man \ --enable-fpm \ --with-fpm-user=apache \ --with-fpm-group=apache \ --with-config-file-path=/etc \ --with-zlib \ --enable-bcmath \ --with-bz2 \ --enable-calendar \ --enable-dba=shared \ --with-gdbm \ --with-gmp \ --enable-ftp \ --with-gettext \ --enable-mbstring \ --with-readline && make
To test the results, issue: make test. A few tests may fail, in which case you are asked whether you want to send the report to the PHP developpers. If you want to automate the test, you may prefix the command with yes "n" | .
Now, as the root
user:
make install && install -v -m644 php.ini-production /etc/php.ini && mv -v /etc/php-fpm.conf{.default,} && install -v -m755 -d /usr/share/doc/php-5.6.6 && install -v -m644 CODING_STANDARDS EXTENSIONS INSTALL NEWS README* UPGRADING* php.gif \ /usr/share/doc/php-5.6.6 && ln -v -sfn /usr/lib/php/doc/Archive_Tar/docs/Archive_Tar.txt \ /usr/share/doc/php-5.6.6 && ln -v -sfn /usr/lib/php/doc/Structures_Graph/docs \ /usr/share/doc/php-5.6.6
The pre-built HTML documentation is packaged in two forms: a
tarball containing many individual files, useful for quick loading
into your browser, and one large individual file, which is useful
for using the search utility of your browser. If you downloaded
either, or both, of the documentation files, issue the following
commands as the root
user to
install them (note these instructions assume English docs, modify
the tarball names below if necessary).
For the “Single HTML” file:
install -v -m644 ../php_manual_en.html.gz \ /usr/share/doc/php-5.6.6 && gunzip -v /usr/share/doc/php-5.6.6/php_manual_en.html.gz
For the “Many HTML files” tarball:
tar -xvf ../php_manual_en.tar.gz \ -C /usr/share/doc/php-5.6.6 --no-same-owner
--with-datadir=/usr/share/php
: This
works around a bug in the build machinery, which installs some data
to a wrong location.
--enable-fpm
: This
parameter allows building the fastCGI Process Manager.
--with-config-file-path=/etc
: This
parameter makes PHP look for the
php.ini
configuration file in
/etc
.
--with-zlib
: This parameter
adds support for Zlib compression.
--enable-bcmath
: Enables
bc style precision
math functions.
--with-bz2
: Adds support
for Bzip2 compression functions.
--enable-calendar
: This
parameter provides support for calendar conversion.
--enable-dba=shared
: This
parameter enables support for database (dbm-style) abstraction
layer functions.
--enable-ftp
: This
parameter enables FTP functions.
--with-gettext
: Enables
functions that use Gettext text
translation.
--enable-mbstring
: This
parameter enables multibyte string support.
--with-readline
: This
parameter enables command line Readline support.
--with-mysql
: This option includes
MariaDB/MySQL support.
--disable-libxml
: This option allows
building PHP without libxml2
installed.
--with-apxs2
: Instead of building the
fastCGI process manager, it is possible to build an apache module. This has some performance
penalty for heavy loaded servers, but may be easier to set up. This
switch is incompatible with the --enable-fpm
and --with-fpm-...
switches.
The file used as the default /etc/php.ini
configuration file is recommended
by the PHP development team.
This file modifies the default behavior of PHP. If no /etc/php.ini
is used, all configuration
settings fall to the defaults. You should review the comments in
this file and ensure the changes are acceptable in your
particular environment.
You may have noticed the following from the output of the make install command:
You may want to add: /usr/lib/php to your php.ini include_path
If desired, add the entry using the following command as the
root
user:
sed -i 's@php/includes"@&\ninclude_path = ".:/usr/lib/php"@' \ /etc/php.ini
To enable fastCGI support in the Apache web server, two LoadModule directives
must be added to the httpd.conf
file. They are commented out, so just issue the following command
as root
user:
sed -i -e '/proxy_module/s/^#//' \ -e '/proxy_fcgi_module/s/^#//' \ /etc/httpd/httpd.conf
Those modules accept various ProxyPass directives. One
possibility is (as the root
user):
echo \ 'ProxyPassMatch ^/(.*\.php)$ fcgi://127.0.0.1:9000/srv/www/$1' >> \ /etc/httpd/httpd.conf
Additionally, it may be useful to add an entry for index.php
to the DirectoryIndex directive of
the httpd.conf
file. Lastly, adding
a line to setup the .phps
extension
to show highlighted PHP source
may be desirable:
AddType application/x-httpd-php-source .phps
You'll need to restart the Apache web server after making any
modifications to the httpd.conf
file.
To automatically start the php-fpm daemon when the system
is rebooted, install the /etc/rc.d/init.d/php
bootscript from the
blfs-bootscripts-20150304 package as the
root
user:
make install-php
Last updated on 2015-02-23 13:51:12 -0800