PHP 5.5.0 and Apache 2.4.4 on CentOS 6.4

In June of 2013, PHP 5.5.0 was released as suitable for production use.  Our internal site used Apache httpd and MediaWiki to test PHP 5.5.0.  Our OS was CentOS 6.4 (64-bit).

We compiled PHP 5.5.0 from scratch, with all the prerequisite packages downloaded and installed, using the following configuration:

#! /bin/sh
#
# Created by configure

'./configure' \
'--enable-intl' \
'--enable-cgi' \
'--with-apxs2=/opt/apache/bin/apxs' \
'--with-pear' \
'--with-libdir=lib64' \
'--with-curl=shared' \
'--with-openssl=shared' \
'--prefix=/opt/php5' \
'--with-gdbm=shared' \
'--enable-dba=shared' \
'--with-db4=shared' \
'--enable-ftp' \
'--with-gd=shared' \
'--with-imap=shared' \
'--with-kerberos=/usr' \
'--with-imap-ssl=shared' \
'--enable-sockets' \
'--enable-zip' \
'--with-jpeg-dir=/usr' \
'--with-png-dir=/usr' \
'--with-xpm-dir=/usr' \
'--with-zlib' \
'--with-zlib-dir=/usr' \
'--with-bz2=shared' \
'--enable-exif' \
'--enable-soap' \
'--with-gmp' \
'--with-mcrypt=/usr/local' \
'--with-mhash' \
'--enable-mbstring' \
'--with-mysql=mysqlnd' \
'--with-mysqli=mysqlnd' \
'--with-pdo-mysql=mysqlnd' \
'--with-snmp=shared' \
'--enable-wddx' \
'--enable-pcntl' \
'--with-xmlrpc=shared' \
'--with-xsl=shared' \
'--with-ldap=shared' \
'--with-ldap-sasl' \
'--with-libedit' \
'--with-readline' \
'--with-pgsql=/usr/local/pgsql/bin/pg_config' \
'--with-pdo-pgsql=/usr/local/pgsql/bin/pg_config' \
"$@"

The configuration above assumed the following:

Other packages which were required by PHP were installed from either the official CentOS yum repository or from each package’s respective official source.

[GARD align=”center”]

The above configure script was saved as config-php.sh and placed above the PHP source directory.  The following commands were issued to start compiling and testing PHP:

cd php-5.5.0
../config-php.sh
make
make test

After the PHP tests were completed, the results were installed in /opt/php5:

sudo make install

In our setup, we used mod_fcgid to execute PHP scripts. See the previous article on installing PHP 5.4 for more information.

To verify that PHP is configured correctly, create a PHP script that contains the following:

<?php

phpinfo();

?>

The above script should generate something similar to this:
PHP Info

As you scroll down, you’ll see more information about the features of your particular PHP installation.

Remember to edit /opt/php/lib/php.ini to set certain variables properly. Here’s a sample php.ini file:

; Choose your preferred time zone and set it here
date.timezone = UTC

; Load extensions (see /opt/php5/lib/php/extensions)
; that you need.
extension = bz2.so
extension = curl.so
extension = dba.so
extension = gd.so
extension = imap.so
extension = ldap.so
extension = openssl.so
extension = snmp.so
extension = xmlrpc.so
extension = xsl.so

You should see information about these extensions in the phpinfo() output.