How To Use Multiple PHP Versions (PHP-FPM & FastCGI) With ISPConfig 3 (Ubuntu 12.10) - Page 2

3 Building PHP 5.3.22 (FastCGI)

Download and extract PHP 5.3.22:

mkdir /opt/phpfcgi-5.3.22
mkdir /usr/local/src/php5-build
cd /usr/local/src/php5-build
wget http://de.php.net/get/php-5.3.22.tar.bz2/from/this/mirror -O php-5.3.22.tar.bz2
tar jxf php-5.3.22.tar.bz2

cd php-5.3.22/

Install the prerequisites for building PHP5:

apt-get install build-essential

apt-get build-dep php5

apt-get install libfcgi-dev libfcgi0ldbl libjpeg62-dbg libmcrypt-dev libssl-dev libc-client2007e libc-client2007e-dev

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

(The last command is needed if you build PHP with --with-imap, because otherwise ./configure will stop with the following error:

checking for crypt in -lcrypt... yes
configure: error: Cannot find imap library (libc-client.a). Please check your c-client installation.
root@server1:/usr/local/src/php5-build/php-5.3.22#

)

Configure and build PHP 5.3.22 as follows (you can adjust the ./configure command to your needs, take a look at

./configure --help

to see all available options; if you use a different ./configure command, it is possible that additional libraries are required, or the build process will fail):

./configure \
--prefix=/opt/phpfcgi-5.3.22 \
--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 \
--with-mhash \
--enable-zip \
--with-pcre-regex \
--with-mysql \
--with-pdo-mysql \
--with-mysqli \
--with-jpeg-dir=/usr \
--with-png-dir=/usr \
--enable-gd-native-ttf \
--with-openssl \
--with-fpm-user=www-data \
--with-fpm-group=www-data \
--with-libdir=/lib/x86_64-linux-gnu \
--enable-ftp \
--with-imap \
--with-imap-ssl \
--with-kerberos \
--with-gettext \
--enable-cgi

The last switch (--enable-cgi) makes sure this PHP version will work with FastCGI.

make
make install

Copy php.ini to the correct location:

cp /usr/local/src/php5-build/php-5.3.22/php.ini-production /opt/phpfcgi-5.3.22/lib/php.ini

That's it - if you like, you can now install some additional modules like APC, memcache, memcached, and ioncube.

The APC, memcache, and memcached modules can be installed through PEAR which we must install and initialize first:

apt-get -y install php-pear

cd /opt/phpfcgi-5.3.22/etc

pecl -C ./pear.conf update-channels

APC can now be installed as follows:

pecl -C ./pear.conf install apc

Accept all default values. Afterwards, open /opt/phpfcgi-5.3.22/lib/php.ini...

vi /opt/phpfcgi-5.3.22/lib/php.ini

... and add the line extension=apc.so at the end of the file (you can also configure some additional APC settings):

[...]
extension=apc.so
apc.enabled=1
apc.shm_size=128M
apc.ttl=0
apc.user_ttl=600
apc.gc_ttl=600
apc.enable_cli=1
apc.mmap_file_mask=/tmp/apc.XXXXXX
;apc.mmap_file_mask=/dev/zero
;apc.shm_segments = 5

The memcache extension can be installed as follows:

pecl -C ./pear.conf install memcache

Open /opt/phpfcgi-5.3.22/lib/php.ini...

vi /opt/phpfcgi-5.3.22/lib/php.ini

... and add the line extension=memcache.so at the end of the file:

[...]
extension=memcache.so

The memcached extension can be installed as follows:

apt-get install libmemcached-dev

pecl -C ./pear.conf install memcached

Open /opt/phpfcgi-5.3.22/lib/php.ini...

vi /opt/phpfcgi-5.3.22/lib/php.ini

... and add the line extension=memcached.so at the end of the file:

[...]
extension=memcached.so

The ionCube Loader can be installed as follows:

cd /tmp

Next download and unpack the correct ionCube Loader package for your architecture (x86_64 or x86).

For x86_64:

wget http://downloads2.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.tar.gz
tar xfvz ioncube_loaders_lin_x86-64.tar.gz

For x86:

wget http://downloads2.ioncube.com/loader_downloads/ioncube_loaders_lin_x86.tar.gz
tar xfvz ioncube_loaders_lin_x86.tar.gz

Proceed as follows:

cp ioncube/ioncube_loader_lin_5.3.so /opt/phpfcgi-5.3.22/lib/php/extensions/no-debug-non-zts-20090626/ioncube.so
vi /opt/phpfcgi-5.3.22/lib/php.ini

Add the line zend_extension = /opt/phpfcgi-5.3.22/lib/php/extensions/no-debug-non-zts-20090626/ioncube.so right at the beginning of the file (before the [PHP] line):

zend_extension = /opt/phpfcgi-5.3.22/lib/php/extensions/no-debug-non-zts-20090626/ioncube.so
[PHP]
[...]

In ISPConfig 3.0.5, you can configure the new PHP version under System > Additional PHP Versions. On the Name tab, you just fill in a name for the PHP version (e.g. PHP 5.3.22) - this PHP version will be listed under this name in the website settings in ISPConfig:

Go to the FastCGI Settings tab (the PHP-FPM Settings tab can be left empty) and fill out the fields as follows:

Share this page:

6 Comment(s)

Add comment

Comments

From: suther at: 2013-05-16 15:03:59

if i do execute your configure-Command on brand new installed debian Squeeze, i got errors like this:
 
configure: error: xml2-config not found. Please check your libxml2 installation.
  1. configure: error: Cannot find OpenSSL's libraries
  2. configure: error: Please reinstall the BZip2 distribution
  3. configure: error: jpeglib.h not found.
  4. configure: error: freetype.h not found.
  5. configure: error: Cannot find imap library (libc-client.a). Please check your c-client installation. (On i686 system...!!! Seems to be a bug with libc-client2007e-dev  so i only could deactivate imap!)
  6. pg-conf not found
 
FIX:
aptitude install libxml2-dev libcurl4-openssl-dev libbz2-dev libjpeg-dev libpng12-dev libxpm-dev libfreetype6-dev libfreetype6-dev libmysqlclient-dev libpq-dev

 For this, the ./configure works for me

Remember, i start from a metal bare squeeze installation! 

From: Cédric at: 2014-06-17 10:25:19

Hello.

On Ubuntu 14.04, after the fix for "libc-client.a", you also have to do the following :

ln -s /usr/include/freetype2 /usr/include/freetype2/freetype

Otherwise ./configure will failed with a "freetype.h not found" error.

Cédric.

From: DahaS at: 2014-08-19 14:21:02

Last php 5.3 version is 5.3.29  (14 Aug 2014).

Here you can get the lastes version http://php.net/downloads.php

From: m0du1us at: 2014-10-16 22:21:05


I'm running Ubuntu 14.04.4 and I get a configure error with freetype.h not being found. This is mentioned in PHP Bug #64405:
https://bugs.php.net/bug.php?id=64405
 
Here's the fix:
referencing my duplicate #66259, pkg-config or freetype-config are flexible options.  here, they produce different results:
pkg-config --cflags --libs freetype2 -I/usr/include/freetype2 -lfreetype freetype-config --cflags --libs -I/usr/include/freetype2 -lfreetype -lz -lpng15 a quick workaround @ php config-time, changing both perl -pi -e 's|(FREETYPE2_INC_DIR)=.*|$1=\$i/include|g' ./configure perl -pi -e 's|freetype2/freetype/freetype.h|freetype2/freetype.h|g' ./configure and export CPPFLAGS="`pkg-config --cflags freetype2`" which 'fixes' missing incorrect path references in GD ext, allows config & build to complete.

From: Lukasz at: 2013-12-03 18:35:13

Following your tutorial found something not right. There is no path in my installation after make install: 

/opt/phpfcgi-5.3.22/etc

In /opt/phpfcgi-5.3.22/ i have: bin, include, lib, man. The 'etc' does not exists in anyone (checked recursively).

From: celocore at: 2014-08-29 15:05:41

...works for ubuntu 14.04 LTS too, but if you start the fpm damon you get "failed" instead of "done" as status. To prepend this you should uncomment the line

;pid = run/php-fpm.pid

in the file

/opt/php-5.4.12/etc/php-fpm.conf

Greets Michael