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 inside the source directory with the following content:


set -e
set -x


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 \

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
➜  ./

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