User Tools

Site Tools


plugins:phpswitcher:fcgid:php5.3

Howto Compile PHP 5.3.x

Introduction

This howto explain how to compile and install PHP5.3.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/php53 && cd php_buildenv/php53
# 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 on X86_64 arch only

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

Fetching PHP sources

# wget http://de.php.net/get/php-5.3.28.tar.bz2/from/this/mirror -O php.tar.bz2
# tar xjf php.tar.bz2
# cd php-5.3.28

Configuration

The configuration options below are for the X86_64 architecture. option for the i386 architecture will be added later.

# ./configure \
--prefix=/opt/php-fcgid/5.3 \
--with-config-file-scan-dir=/opt/php-fcgid/5.3/conf.d \
--with-pdo-pgsql \
--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=mysqlnd \
--with-pdo-mysql=mysqlnd \
--with-mysqli=mysqlnd \
--with-mysql-sock=/var/run/mysqld/mysqld.sock \
--with-jpeg-dir=/usr \
--with-png-dir=/usr \
--enable-gd-native-ttf \
--with-openssl \
--with-libdir=/lib/x86_64-linux-gnu \
--enable-ftp \
--with-imap \
--with-imap-ssl \
--with-kerberos \
--with-gettext \
--with-xmlrpc \
--with-xsl \
--enable-cgi

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.3/bin/php-cgi -v

which should give a result such as:

PHP 5.3.28 (cgi-fcgi) (built: Feb 20 2014 18:02:14)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2013 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.3 (Fcgid)This is the unique name for the new PHP version
PHP binary path/opt/php-fcgid/5.3/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

Once it's done and if all goes well, your customers should be able to switch to this new PHP version using their own PhpSwitcher interface, which is available in the Domains section.

Troubleshootings

If you are running MariaDB on your server and if you encounter some problems while trying to install PHP build packages, you must temporary switch to the MySQL version as provided by your distribution. This can be done easily by using the i-MSCP installer.

The tips about MariaDB above is not a viable solution. A better solution will be show later.

/var/www/virtual/i-mscp.net/wiki/htdocs/data/pages/plugins/phpswitcher/fcgid/php5.3.txt · Last modified: 2014/04/24 01:25 by nuxwin