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.3 platform.
Download (HTTP): http://us2.php.net/distributions/php-5.4.11.tar.bz2
Download MD5 sum: 9975e68c22b86b013b934743ad2d2276
Download size: 10.6 MB
Estimated disk space required: 522 MB (includes installing all documentation)
Estimated build time: 2.6 SBU (additional 2.2 SBU to run the test suite)
Pre-built documentation (optional): http://www.php.net/download-docs.php
libxslt-1.1.28, PCRE-8.32, Aspell-0.60.6.1, enchant-1.6.0, pkg-config-0.28, expat-2.1.0 (deprecated alternative to libxml2-2.9.1), OSSP mm, Net-SNMP, Pth-2.0.7, re2c, XMLRPC-EPI, Dmalloc, and an MTA (that provides a sendmail command)
PHP also provides support for many commercial database tools such as Oracle, SAP and ODBC Router.
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.1 installed,
you need to add
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 \ --with-apxs2 \ --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. Some of the tests are known to fail.
Now, as the
make install && install -v -m644 php.ini-production /etc/php.ini && install -v -m755 -d /usr/share/doc/php-5.4.11 && install -v -m644 CODING_STANDARDS EXTENSIONS INSTALL NEWS \ README* UPGRADING* php.gif \ /usr/share/doc/php-5.4.11 && ln -v -sfn /usr/lib/php/doc/Archive_Tar/docs/Archive_Tar.txt \ /usr/share/doc/php-5.4.11 && ln -v -sfn /usr/lib/php/doc/Structures_Graph/docs \ /usr/share/doc/php-5.4.11
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.4.11 && gunzip -v /usr/share/doc/php-5.4.11/php_manual_en.html.gz
For the “Many HTML files” tarball:
tar -xvf ../php_manual_en.tar.gz \ -C /usr/share/doc/php-5.4.11 --no-same-owner
parameter builds the Apache HTTPD 2.0 module.
parameter makes PHP look for the
php.ini configuration file in
--with-zlib: This parameter
adds support for Zlib compression.
bc style precision
--with-bz2: Adds support
for Bzip2 compression functions.
parameter provides support for calendar conversion.
parameter enables support for database (dbm-style) abstraction
parameter enables FTP functions.
functions that use Gettext text
parameter enables multibyte string support.
parameter enables command line Readline support.
--disable-libxml: This option allows
building PHP without libxml2
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
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
sed -i 's@php/includes"@&\ninclude_path = ".:/usr/lib/php"@' \ /etc/php.ini
To enable PHP support in the Apache web server, a new LoadModule (which
should be handled automatically by the make install command) and
AddType directives must be added to the
LoadModule php5_module lib/apache/libphp5.so AddType application/x-httpd-php .php
Additionally, it can be useful to add an entry for
index.php to the DirectoryIndex directive of
httpd.conf file. Lastly, adding
a line to setup the
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
Last updated on 2013-03-14 01:39:01 +0000