Compile PHP-5.6 with Apache Worker support

A look at PHP-5.6

The Apache Worker implements a hybrid multi-process multi-threaded server allowing to serve a large number of requests per second using fewer resources than Prefork module then is a good option if your site is under heavy load. Other advantages of using Apache Worker is that it allows to create multi-threaded applications making use of pthreads extension

Note: while the PHP development team does not recommend use PHP with Apache threaded modules since some extensions are not "thread safe" and therefore may have a wrong behavior I have successfully tested it with 2 applications used on a large scale: WordPress and phpMyAdmin.

Download php-5.6.4



tar xJvf php-5.6.4.tar.xz

Download and run the script to install dependencies

$ wget --no-check-certificate && 
        chmod a+x -c && 
        ./ apache-worker

Download script to compile php

$ wget --no-check-certificate && 
        chmod a+x -c

Compile php

$./ -at php-5.6.4

where -a = support for apache, -t = support multithreading (thread safe)


$ cd php-5.6.4 && sudo make install

Create php configuration file


sudo cp -v php.ini-development /etc/php/php.ini


sudo cp -v php.ini /etc/php/php.ini

Activate OpCache

If you use Xdebug then OpCache should be loaded first

$ sudo bash -c 'echo "" > /etc/php/conf.d/20-opcache.ini'

Restart the Apache

sudo service apache2 restart

We check

$ firefox http://localhost/info.php

How to compile PHP from the source code, 8 (11)

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.