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
wget http://us1.php.net/distributions/php-5.6.4.tar.xz
Unpack
tar xJvf php-5.6.4.tar.xz
Download and run the script to install dependencies
$ wget --no-check-certificate https://raw.githubusercontent.com/yoander/sysadmin/master/shscript/php-dev-install-dep.sh &&
chmod a+x -c php-dev-install-dep.sh &&
./php-dev-install-dep.sh apache-worker
Download script to compile php
$ wget --no-check-certificate https://raw.githubusercontent.com/yoander/sysadmin/master/shscript/php-build.sh &&
chmod a+x -c php-build.sh
Compile php
$./php-build.sh -at php-5.6.4
where -a = support for apache, -t = support multithreading (thread safe)
Install
$ cd php-5.6.4 && sudo make install
Create php configuration file
Development
sudo cp -v php.ini-development /etc/php/php.ini
Production
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 "zend_extension=opcache.so" > /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)
- How to compile PHP 7.1 in Ubuntu 16.04
- Butterfly Builder, a tool to compile PHP
- How to compile PHP 7.4 on Ubuntu 18.04
- How to compile PHP-7.3 en Debian
- How to compile PHP-7.2 on CentOS
- How to Compile PHP 8.0 in Debian 10?
- Compile php 5.5 with apache prefork support
- Compile PHP-5.6 with Apache Worker support
- Compile php-5.6 with fpm support
- How to compile PHP-5.6 on CentOS 7
- Compile PHP 7 on Debian 8