Building PHP 4.4.4

Building a Web Server, for Linux



Our Configuration

Configuration Options

Displays a list of configuration options...

php-4.4.4]# ./configure --help

Build Instructions


Configure the php build with openssl, zlib, and mysql [libs]...

php-4.4.4]# ./configure --prefix=/usr/local/php-4.4.4 --with-apxs2=/usr/local/apache2/bin/apxs --with-openssl=/usr/local/ssl --with-zlib=/usr/local --with-mysql=/usr/local/mysql
Build and Install
[sanity check] Runtime Linker

Verify that Apache module '' is linking against the correct zlib and ssl libraries...

...]# ldd /usr/local/apache2/modules/

Form symlink from '/usr/local/php-4.4.4' to '/usr/local/php'...


Create php.ini...

php-4.4.4]# cp php.ini-recommended /usr/local/php/lib/php.ini

Note that if PHP was not built with '--prefix=DIR' [php installed to default location], create php.ini under '/usr/local/lib/'

php.ini can also be placed under /etc/ for global settings -- make sure no old php.ini files reside under this directory.

Edit /usr/local/php/lib/php.ini...

Configuration for Apache 2.0

Edit /usr/local/apache2/conf/httpd.conf

PHP as an Apache Module
LoadModule php4_module modules/

DirectoryIndex index.html index.html.var index.php index.php4

<Location />
	AddType text/html .php .phps
	AddHandler application/x-httpd-php .php
	AddHandler application/x-httpd-php-source .phps

[Recommended] Method #1...

ScriptAlias /cgi-bin/ "/usr/local/apache2/cgi-bin/"

<Directory "/usr/local/apache2/cgi-bin">
	AllowOverride None
	Options None
	Order allow,deny
	Allow from all

Method #2...

AddHandler php-script .php
AddType text/html .php

Method #3...

AddHandler cgi-script .php
AddType text/html .php

Configuration for zlib

Modifications need to be made to php.ini to switch on zlib compression detection and encoding.

Edit php.ini...


Create file 'phpinfo.php', containing the following code...

<?php phpinfo(); ?>

Place 'phpinfo.php' under your document root directory.

Access URL http://localhost/phpinfo.php