apt-get install build-essential pkg-config autoconf bison re2c libxml2-dev libssl-dev libsqlite3-dev libcurl4-openssl-dev libpng-dev libjpeg-dev libonig-dev libfreetype6-dev libxslt1-dev libzip-dev libtidy-dev libmysqlclient-dev cd /usr/local/src VERSION=7.4.21 wget -qO- https://www.php.net/distributions/php-${VERSION}.tar.gz | tar -xz cd php-${VERSION}/ext git clone --depth 1 --branch v1.1.4 https://github.com/krakjoe/parallel.git cd .. ./buildconf --force ./configure \ --prefix=/etc/php/7.4z \ --with-config-file-path=/etc/php/7.4z \ --with-config-file-scan-dir=/etc/php/7.4z/conf.d \ --disable-cgi \ --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-freetype \ --with-xsl \ --with-gettext \ --enable-bcmath \ --enable-mbstring \ --enable-calendar \ --with-tidy \ --enable-maintainer-zts \ --enable-parallel \ --enable-ftp \ --enable-sockets make -j$(nproc) make install cp php.ini-production /etc/php/7.4z/php.ini ln -s /etc/php/7.4z/bin/php /usr/bin/php74z
Additional config: OPCache needs to be turned on, otherwise may run to memory corruption error in parallel extension.
mkdir /etc/php/7.4z/conf.d nano /etc/php/7.4z/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 extension=amqp.so pdo_mysql.default_socket="/var/run/mysqld/mysqld.sock"