Install PHP 7.4 ZTS with ext-parallel in Ubuntu

sudo apt install bison re2c libxml2-dev libssl-dev libsqlite3-dev \
libbz2-dev libcurl4-openssl-dev libpng-dev libjpeg-dev libonig-dev \
libfreetype6-dev libxslt1-dev libzip-dev libwebp-dev libtidy-dev

VERSION=7.4.8
wget https://github.com/php/php-src/archive/php-${VERSION}.tar.gz
tar -xf php-${VERSION}.tar.gz
cd php-src-php-${VERSION}/ext

#VERSION=1.1.3
#wget https://github.com/krakjoe/parallel/archive/v${VERSION}.tar.gz
#tar -xf v${VERSION}.tar.gz
#rm v${VERSION}.tar.gz
#mv parallel-${VERSION} parallel

git clone --depth=1 https://github.com/krakjoe/parallel.git

git clone --recursive --depth=1 https://github.com/kjdev/php-ext-brotli.git brotli

cd ..
./buildconf --force

./configure \
    --prefix=/etc/php7z \
    --with-config-file-path=/etc/php7z \
    --with-config-file-scan-dir=/etc/php7z/conf.d \
    --disable-cgi \
    --with-bz2 \
    --with-zlib \
    --with-zip \
    --enable-soap \
    --enable-intl \
    --with-openssl \
    --with-curl \
    --enable-mysqlnd \
    --with-mysqli=mysqlnd \
    --with-pdo-mysql=mysqlnd \
    --enable-pcntl \
    --enable-gd \
    --enable-exif \
    --with-jpeg \
    --with-webp \
    --with-freetype \
    --with-xsl \
    --enable-bcmath \
    --enable-mbstring \
    --enable-calendar \
    --with-tidy \
    --enable-maintainer-zts \
    --enable-parallel \
    --enable-brotli

make -j$(nproc)
sudo make install

cp php.ini-development /etc/php7z/php.ini

sudo ln -s /etc/php7z/bin/php /usr/bin/phpz

Additional config: OPCache needs to be turned on, otherwise may run to memory corruption error with parallel extension.

touch /etc/php7z/conf.d/additional.ini
nano /etc/php7z/conf.d/additional.ini
memory_limit=-1

[opcache]
zend_extension=opcache
opcache.enable=1
opcache.enable_cli=1
opcache.memory_consumption=512
opcache.interned_strings_buffer=128