Configuration and Building

This assumes you are going to run PHP as your user (instead of www-data or similar as normaly in production).

Create a new file called build.sh inside the source directory with the following content:

#!/bin/bash

set -e
set -x

INSTALL_DIR=/home/lukas/php/php8
USER=$(whoami)

mkdir -p $INSTALL_DIR

./configure --prefix=$INSTALL_DIR \
    --enable-bcmath \
    --enable-fpm \
    --with-fpm-user="$USER" \
    --with-fpm-group="$USER" \
    --disable-cgi \
    --enable-mbstring \
    --enable-shmop \
    --enable-sockets \
    --enable-sysvmsg \
    --enable-sysvsem \
    --enable-sysvshm \
    --with-zlib \
    --with-curl \
    --without-pear \
    --with-openssl \
    --enable-pcntl \
    --with-password-argon2 \
    --with-sodium \
    --with-zip \
    --enable-mysqlnd \
    --with-pdo-mysql \
    --with-pdo-mysql=mysqlnd \
    --enable-gd \
    --with-freetype \
    --enable-opcache

This should enable all PHP modules Matomo needs to run. If you need more, adjust the lines above (and don't forget to end them with a \)

Now run this script:

➜  chmod +x build.sh
➜  ./build.sh

Afterwards we can start compiling PHP:

➜  make
# or if you want to use 6 processes in parallel 
➜  make -j 6

You can now optionally run the tests (don't worry if a few of them fail in beta versions)

➜  make test

And the last step is to install PHP to our INSTALL_DIR:

➜  make install

Revision #3
Created Thu, Aug 12, 2021 10:21 AM by Lukas
Updated Thu, Aug 12, 2021 10:40 AM by Lukas