PHP-8 (zts) & Apache & Swoole/Parallel (+ WordPress) with Docker/Ubuntu/PhpBrew

We had another scenario, where the mentioned combination was needed to be installed. It was a bit cumbersome, but the final solution turned out to be:

### METHOD 1: using Docker ###

If you want to use ubuntu (instead of debian), the I reckon Ubuntu (phusion image) as the champion image for docker and so, to build your PHP8 on top of that, you can Download official php8-docker folder and modify Dockerfile with the changes shown in this DIFF and build it. (or you can also use ready-made LAMP image)

P.S. We recommend to look into the useful docker commands. Whoever wants, steps to install Redis )

WordPress

To install wordpress on top of the above image, download https://github.com/docker-library/wordpress and modify Dockerfile with changes as shown in this DIFF and build it. (if you want to connect to outside MYSQL server, you might need this tip)

### METHOD 2 : using PhpBrew ###

After following “requirements” part of phpbrew, then install PHP with phpbrew. at first check if echo $PKG_CONFIG_PATH variable returns result, if not, set it:

export PKG_CONFIG_PATH=/usr/lib/pkgconfig1

Then use

sudo apt-get install apache2-dev
sudo apt-get install libonig-dev
sudo chmod -R oga+rw /etc/apache2

#if you having problems with phpbrew, read this: https://github.com/phpbrew/phpbrew/wiki/Cookbook#install-phpbrew-into-system-wide-environment
phpbrew --debug install 8.0 +default +mysql +sqlite +mb +curl +bcmath +debug +fpm +zip +intl +openssl=/usr/local/opt/openssl +bz2=/usr/local/opt/bzip2 +zlib=/usr/local/opt/zlib +apxs2=/usr/bin/apxs2  +zts -- --enable-zts #for php7 (instead of +zts) in the end needs -- --enable-maintainer-zts phpbrew --debug ext install swoole phpbrew --debug ext install parallel #or follow instructions from github readme. If the command doesn't success, use: phpbrew ext install parallel -- --enable-parallel-coverage --enable-parallel-dev #p.s. you might need also these extensions in addition to above ones (for wordpress): +xmlrpc +gd +soap

and this will help to tell apache to use phpbrew: here or here

 

 

____________

* Other components: some people might want to compile php with different components, like --with-gmp or etc. However, in such case, the needed module bases should be installed before php-module, so, in dockerfile you might need to put RUN apt-get update && apt-get install -y libgmp-dev before the php-build line.

1 thought on “PHP-8 (zts) & Apache & Swoole/Parallel (+ WordPress) with Docker/Ubuntu/PhpBrew”

  1. Pingback: Docker & phpBrew (php-7 zts) & WordPress – Puvox – Blog

Leave a Comment

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

WordPress › Error

There has been a critical error on this website.

Learn more about troubleshooting WordPress.