User Tools

Site Tools


plugins:phpswitcher:fcgid:php5.2

Howto Compile PHP 5.2.x

Introduction

This howto explain how to compile and install PHP5.2.x on Debian, to be run as a FastCGI application (Fcgid). This howto also explain how to register this PHP version through the PhpSwitcher plugin.

Creating build environment

# cd /usr/local/src
# mkdir -p php_buildenv/php52 && cd php_buildenv/php52
# apt-get update && apt-get install build-essential

Installing build dependencies

# apt-get build-dep php5
# apt-get install libfcgi-dev libfcgi0ldbl libjpeg62-dbg libmcrypt-dev \
libssl-dev libc-client2007e libc-client2007e-dev libpq5

Needed for php-imap module

# For X86_64  architectures
ln -s /usr/lib/libc-client.a /usr/lib/x86_64-linux-gnu/libc-client.a

# For i386 architectures
ln -s /usr/lib/libc-client.a /usr/lib/i386-linux-gnu/libc-client.a

Fetching PHP sources

# wget http://museum.php.net/php5/php-5.2.17.tar.gz
# tar -xzf php-5.2.17.tar.gz
# cd php-5.2.17

The sources must be patched

More information about why the sources must be patched are needed.

curl "https://bugs.php.net/patch-display.php?bug_id=54736&patch=debian_patches_disable_SSLv2_for_openssl_1_0_0.patch&revision=1305414559&download=1" -s -o debian_patches_disable_SSLv2_for_openssl_1_0_0.patch.patch 
patch -p1 < debian_patches_disable_SSLv2_for_openssl_1_0_0.patch.patch

Configuration

For 32 bits operating systems

# ./configure \
--prefix=/opt/php-fcgid/5.2 \
--with-config-file-scan-dir=/opt/php-fcgid/5.2/conf.d \
--with-zlib-dir \
--with-freetype-dir \
--enable-mbstring \
--with-libxml-dir=/usr \
--enable-soap \
--enable-calendar \
--with-curl \
--with-mcrypt \
--with-zlib \
--with-gd \
--with-pgsql \
--disable-rpath \
--enable-inline-optimization \
--with-bz2 \
--with-zlib \
--enable-sockets \
--enable-sysvsem \
--enable-sysvshm \
--enable-pcntl \
--enable-mbregex \
--enable-exif \
--enable-bcmath \
--with-mhash \
--enable-zip \
--with-pcre-regex \
--with-mysql \
--with-mysql-sock=/var/run/mysqld/mysqld.sock \
--with-mysqli=/usr/bin/mysql_config \
--with-pdo-mysql \
--with-pdo-pgsql \
--with-jpeg-dir=/usr \
--with-png-dir=/usr \
--enable-gd-native-ttf \
--with-openssl \
--enable-ftp \
--with-kerberos \
--with-gettext \
--with-xmlrpc \
--with-xsl \
--enable-fastcgi \
--enable-cgi \
--enable-force-cgi-redirect \
--with-imap \
--with-imap-ssl \
--with-libdir=/lib/i386-linux-gnu 

For 64 bits operating systems

# ./configure \
--prefix=/opt/php-fcgid/5.2 \
--with-config-file-scan-dir=/opt/php-fcgid/5.2/conf.d \
--with-zlib-dir \
--with-freetype-dir \
--enable-mbstring \
--with-libxml-dir=/usr \
--enable-soap \
--enable-calendar \
--with-curl \
--with-mcrypt \
--with-zlib \
--with-gd \
--with-pgsql \
--disable-rpath \
--enable-inline-optimization \
--with-bz2 \
--with-zlib \
--enable-sockets \
--enable-sysvsem \
--enable-sysvshm \
--enable-pcntl \
--enable-mbregex \
--enable-exif \
--enable-bcmath \
--with-mhash \
--enable-zip \
--with-pcre-regex \
--with-mysql \
--with-mysql-sock=/var/run/mysqld/mysqld.sock \
--with-mysqli=/usr/bin/mysql_config \
--with-pdo-mysql \
--with-pdo-pgsql \
--with-jpeg-dir=/usr \
--with-png-dir=/usr \
--enable-gd-native-ttf \
--with-openssl \
--enable-ftp \
--with-kerberos \
--with-gettext \
--with-xmlrpc \
--with-xsl \
--enable-fastcgi \
--enable-cgi \
--enable-force-cgi-redirect \
--with-imap \
--with-imap-ssl \
--with-libdir=/lib/x86_64-linux-gnu

Note: If you need more modules, you must tune the configuration options and install needed libraries.

Compilation and installation

# make
# make install

Checking

Test your php binary by running the following command:

# /opt/php-fcgid/5.2/bin/php-cgi -v

which should give a result such as (look for the fgci part):

PHP 5.2.17 (cgi-fcgi) (built: Mar  6 2014 17:13:47)
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2010 Zend Technologies

Registration through PhpSwitcher

  1. Login into the panel as administrator and go to the PhpSwitcher interface (settings section)
  2. Create a new PHP version with the following parameters:
ParameterValueDescription
NamePHP5.2 (Fcgid)This is the unique name for the new PHP version
PHP binary path/opt/php-fcgid/5.2/bin/php-cgiThis is the path of the PHP binary
PHP configuration directory/var/www/fcgiThis is the directory in which customers's PHP configuration files are stored
/var/www/virtual/i-mscp.net/wiki/htdocs/data/pages/plugins/phpswitcher/fcgid/php5.2.txt · Last modified: 2014/04/24 02:24 by nuxwin