Simon Bennett

Web Developer

Web Development Simon Bennett

Compile PHP with threads and proccesses

Posted: May 19, 2013

For my university dissertation next year I am going to need to create a high performance application in PHP and the only way to perform this is by multi threading and multi processing the workload.

As the documentation on the area is not amazing for telling you how to install it I thought I would post how I managed it. (You may need to update the links)

wget http://uk1.php.net/distributions/php-5.4.15.tar.bz2
apt-get update
apt-get upgrade -yq
apt-get -yq install bzip2 openssl libxml2 libxml2-dev gcc make autoconf htop sudo git dstat
tar xvjf php-5*.tar.bz2
cd php-5*
cd ext/
git clone git://github.com/krakjoe/pthreads.git
cd ../
./buildconf –force
./configure –enable-maintainer-zts –enable-sockets –enable-pcntl –enable-pthreads –with-tsrm-pthreads
make
make test
make install

Or If you want a one liner

wget https://gist.github.com/wgas/5670447/raw/5ee73da80e677e968d00be555b1e2a84793dff34/InstallPHP; sudo sh InstallPHP

You can all more options to the configuring of php depending what you need.

Written By Simon Bennett (find me on )

Leave a Reply