PHP-5.0.4

Introduction to PHP

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.

Package Information

Additional Downloads

PHP Dependencies

Required

Apache-2.0.54

Optional

libxml2-2.6.20, libxslt-1.1.14, OpenSSL-0.9.7g, ClibPDF, libjpeg-6b, libtiff-3.7.3, cURL-7.14.0, QDBM, cdb, GDBM-1.8.3, Berkeley DB-4.3.28, FAM-2.7.0, GD, libpng-1.2.8, X (X.org-6.8.2 or XFree86-4.5.0), FreeType-2.1.10, t1lib, GMP-4.1.4 MySQL-4.1.12, PCRE-6.1, PostgreSQL-8.0.3, Aspell-0.60.3, pkg-config-0.19, HTML Tidy-050722, OpenLDAP-2.2.24, Cyrus SASL-2.1.21, MIT krb5-1.4.1 or Heimdal-0.7, libmcrypt, mhash, OSSP mm, Net-SNMP, SQLite, Dmalloc, mnoGoSearch, Mini SQL, Empress, Birdstep, DBMaker, Adabas, FrontBase, Caudium, WDDX, FDF Toolkit, Hyperwave, Monetra, expat-1.95.8 and MTA

Installation of PHP

[Note]

Note

You can use PHP for server-side scripting, command line scripting or client-side GUI applications. The book provides instructions for setting up PHP for server-side scripting as it is the most common form.

If you have Berkeley DB installed and wish to utilize it, apply the following patch:

patch -Np1 -i ../php-5.0.4-db43-1.patch

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 \
            --enable-exif \
            --enable-ftp \
            --with-gettext \
            --enable-mbstring \
            --with-ncurses \
            --with-readline \
            --disable-libxml &&
make

To test the results, issue: make test.

Now, as the root user:

make install &&
cp -v php.ini-recommended /etc/php.ini

Remove the --disable-libxml switch if you have libxml2-2.6.20 installed otherwise pear will not be built.

[Note]

Note

PHP has many more configure options that will enable support for certain 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.

Command Explanations

--with-apxs2: This parameter builds the Apache 2.0 module.

--with-config-file-path=/etc: This parameter puts 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: Add support for bz2 compression functions.

--enable-calendar: This parameter provides support for calendar conversion.

--enable-dba: This parameter enables numerous database support including Berkeley DB functions.

--enable-exif: Enables functions to access metadata from images.

--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-ncurses: Provides ncurses terminal independent cursor handling.

--with-readline: This parameter enables command line readline support.

--disable-libxml: This parameter disables XML support functions.

Configuring PHP

Config Files

/etc/php.ini, /etc/pear.conf

Configuration Information

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 httpd.conf file:

LoadModule php5_module lib/apache/libphp5.so
AddType application/x-httpd-php .php

Also, it can be useful to add an entry for index.php to the DirectoryIndex directive of the httpd.conf file.

You'll need to restart the Apache web server after making any modifications to the httpd.conf file.

Contents

Installed Programs: pear, php, php-config, phpextdist, and phpize
Installed Library: libphp5.so
Installed Directories: /usr/include/php and /usr/lib/php

Short Descriptions

php

is a command line interface that enables you to parse and execute PHP code.

pear

is the PHP Extension and Application Repository (PEAR) package manager.

Last updated on 2005-08-01 13:29:19 -0600