Linux

Compile PHP 7.1, 7.2 and 7.3 besides 7.0

Configure PHP 7.1

apt-get install build-essential nano
apt-get install libzip-dev libfcgi-dev libfcgi0ldbl libjpeg62-turbo-dev libmcrypt-dev libssl-dev libc-client2007e libc-client2007e-dev libxml2-dev libbz2-dev libcurl4-openssl-dev libjpeg-dev libpng-dev libfreetype6-dev libkrb5-dev libpq-dev libxml2-dev libxslt1-dev
ln -s /usr/lib/libc-client.a /usr/lib/x86_64-linux-gnu/libc-client.a
cd /usr/include
ln -s x86_64-linux-gnu/curl
mkdir -p /opt/php-7.1
mkdir /usr/local/src/php7.1-build
cd /usr/local/src/php7.1-build
wget http://de2.php.net/get/php-7.1.25.tar.bz2/from/this/mirror -O php-7.1.25.tar.bz2
tar jxf php-7.1.25.tar.bz2

./configure --prefix=/opt/php-7.1 --with-pdo-pgsql --with-zlib-dir --with-freetype-dir --enable-mbstring --with-libxml-dir=/usr --enable-soap --enable-calendar --with-curl --with-mcrypt --with-zlib --with-gd --with-pgsql --disable-rpath --enable-inline-optimization --with-bz2 --with-zlib --enable-sockets --enable-sysvsem --enable-sysvshm --enable-pcntl --enable-mbregex --enable-exif --enable-bcmath --with-mhash --enable-zip --with-pcre-regex --with-pdo-mysql --with-mysqli --with-mysql-sock=/var/run/mysqld/mysqld.sock --with-jpeg-dir=/usr --with-png-dir=/usr --enable-gd-native-ttf --with-openssl --with-fpm-user=www-data --with-fpm-group=www-data --with-libdir=/lib/x86_64-linux-gnu --enable-ftp --with-imap --with-imap-ssl --with-kerberos --with-gettext --with-xmlrpc --with-xsl --enable-opcache --enable-fpm
make
make install

cp /usr/local/src/php7.1-build/php-7.1.25/php.ini-production /opt/php-7.1/lib/php.ini
cp /opt/php-7.1/etc/php-fpm.conf.default /opt/php-7.1/etc/php-fpm.conf
cp /opt/php-7.1/etc/php-fpm.d/www.conf.default /opt/php-7.1/etc/php-fpm.d/www.conf
vi /opt/php-7.1/etc/php-fpm.conf

[...]
pid = run/php-fpm.pid
[...]
vi /opt/php-7.1/etc/php-fpm.d/www.conf
[...]
listen = 127.0.0.1:8999
[...]
vi /lib/systemd/system/php-7.1-fpm.service
[Unit]
Description=The PHP 7.1 FastCGI Process Manager
After=network.target
[Service]
Type=simple
PIDFile=/opt/php-7.1/var/run/php-fpm.pid
ExecStart=/opt/php-7.1/sbin/php-fpm --nodaemonize --fpm-config /opt/php-7.1/etc/php-fpm.conf
ExecReload=/bin/kill -USR2 $MAINPID
[Install]
WantedBy=multi-user.target
systemctl enable php-7.1-fpm.service
systemctl daemon-reload
systemctl start php-7.1-fpm.service
vi /opt/php-7.1/lib/php.ini
zend_extension=opcache.so
# test:
cd /opt/php-7.1/bin
./php --version
# ispconfig:
FastCGI Settings tab:
Path to the PHP FastCGI binary: /opt/php-7.1/bin/php-cgi
Path to the php.ini directory: /opt/php-7.1/lib
PHP-FPM Settings tab:
Path to the PHP-FPM init script: php-7.1-fpm
Path to the php.ini directory: /opt/php-7.1/lib
Path to the PHP-FPM pool directory: /opt/php-7.1/etc/php-fpm.d

Configure PHP 7.2

mkdir -p /opt/php-7.2

mkdir /usr/local/src/php7.2-build

cd /usr/local/src/php7.2-build
wget http://de2.php.net/get/php-7.2.13.tar.bz2/from/this/mirror -O php-7.2.13.tar.bz2
tar jxf php-7.2.13.tar.bz2
cd php-7.2.13

./configure --prefix=/opt/php-7.2 --with-pdo-pgsql --with-zlib-dir --with-freetype-dir --enable-mbstring --with-libxml-dir=/usr --enable-soap --enable-calendar --with-curl --with-zlib --with-gd --with-pgsql --disable-rpath --enable-inline-optimization --with-bz2 --with-zlib --enable-sockets --enable-sysvsem --enable-sysvshm --enable-pcntl --enable-mbregex --enable-exif --enable-bcmath --with-mhash --enable-zip --with-pcre-regex --with-pdo-mysql --with-mysqli --with-mysql-sock=/var/run/mysqld/mysqld.sock --with-jpeg-dir=/usr --with-png-dir=/usr --with-openssl --with-fpm-user=www-data --with-fpm-group=www-data --with-libdir=/lib/x86_64-linux-gnu --enable-ftp --with-imap --with-imap-ssl --with-kerberos --with-gettext --with-xmlrpc --with-xsl --enable-opcache --enable-fpm
make
make install

cp /usr/local/src/php7.2-build/php-7.2.13/php.ini-production /opt/php-7.2/lib/php.ini
cp /opt/php-7.2/etc/php-fpm.conf.default /opt/php-7.2/etc/php-fpm.conf
cp /opt/php-7.2/etc/php-fpm.d/www.conf.default /opt/php-7.2/etc/php-fpm.d/www.conf

vi /opt/php-7.2/etc/php-fpm.conf
[...]
pid = run/php-fpm.pid
[...]

vi /opt/php-7.2/etc/php-fpm.d/www.conf
[...]
listen
= 127.0.0.1:8998
[...]

vi /lib/systemd/system/php-7.2-fpm.service

[Unit]
Description=The PHP 7.2 FastCGI Process Manager
After=network.target

[Service]
Type=simple
PIDFile=/opt/php-7.2/var/run/php-fpm.pid
ExecStart=/opt/php-7.2/sbin/php-fpm --nodaemonize --fpm-config /opt/php-7.2/etc/php-fpm.conf
ExecReload=/bin/kill -USR2 $MAINPID

[Install]
WantedBy=multi-user.target

systemctl enable php-7.2-fpm.service
systemctl daemon-reload
systemctl start php-7.2-fpm.service
vi /opt/php-7.2/lib/php.ini
[...]
zend_extension=opcache.so

# ispconfig:
FastCGI Settings tab:
Path to the PHP FastCGI binary: /opt/php-7.2/bin/php-cgi
Path to the php.ini directory: /opt/php-7.2/lib

PHP-FPM Settings tab:
Path to the PHP-FPM init script: php-7.2-fpm
Path to the php.ini directory: /opt/php-7.2/lib
Path to the PHP-FPM pool directory: /opt/php-7.2/etc/php-fpm.d

Configure PHP 7.3

mkdir -p /opt/php-7.3

mkdir /usr/local/src/php7.3-build

cd /usr/local/src/php7.3-build
wget http://de2.php.net/get/php-7.3.0.tar.bz2/from/this/mirror -O php-7.3.0.tar.bz2
tar jxf php-7.3.0.tar.bz2

cd php-7.3.0
apt-get install libzip-dev
./configure --prefix=/opt/php-7.3 --with-pdo-pgsql --with-zlib-dir --with-freetype-dir --enable-mbstring --with-libxml-dir=/usr --enable-soap --enable-calendar --with-curl --with-zlib --with-gd --with-pgsql --disable-rpath --enable-inline-optimization --with-bz2 --with-zlib --enable-sockets --enable-sysvsem --enable-sysvshm --enable-pcntl --enable-mbregex --enable-exif --enable-bcmath --with-mhash --enable-zip --with-pcre-regex --with-pdo-mysql --with-mysqli --with-mysql-sock=/var/run/mysqld/mysqld.sock --with-jpeg-dir=/usr --with-png-dir=/usr --with-openssl --with-fpm-user=www-data --with-fpm-group=www-data --with-libdir=/lib/x86_64-linux-gnu --enable-ftp --with-imap --with-imap-ssl --with-kerberos --with-gettext --with-xmlrpc --with-xsl --enable-opcache --enable-fpm
make
make install

cp /usr/local/src/php7.3-build/php-7.3.0/php.ini-production /opt/php-7.3/lib/php.ini
cp /opt/php-7.3/etc/php-fpm.conf.default /opt/php-7.3/etc/php-fpm.conf
cp /opt/php-7.3/etc/php-fpm.d/www.conf.default /opt/php-7.3/etc/php-fpm.d/www.conf

vi /opt/php-7.3/etc/php-fpm.conf
[...]
pid = run/php-fpm.pid
[...]

vi /opt/php-7.3/etc/php-fpm.d/www.conf
[...]
listen
= 127.0.0.1:8997
[...]

vi /lib/systemd/system/php-7.3-fpm.service

[Unit]
Description=The PHP 7.3 FastCGI Process Manager
After=network.target

[Service]
Type=simple
PIDFile=/opt/php-7.3/var/run/php-fpm.pid
ExecStart=/opt/php-7.3/sbin/php-fpm --nodaemonize --fpm-config /opt/php-7.3/etc/php-fpm.conf
ExecReload=/bin/kill -USR2 $MAINPID

[Install]
WantedBy=multi-user.target

systemctl enable php-7.3-fpm.service
systemctl daemon-reload
systemctl start php-7.3-fpm.service
vi /opt/php-7.3/lib/php.ini
[...]
zend_extension=opcache.so

# ispconfig:
FastCGI Settings tab:
Path to the PHP FastCGI binary: /opt/php-7.3/bin/php-cgi
Path to the php.ini directory: /opt/php-7.3/lib

PHP-FPM Settings tab:
Path to the PHP-FPM init script: php-7.3-fpm
Path to the php.ini directory: /opt/php-7.3/lib
Path to the PHP-FPM pool directory: /opt/php-7.3/etc/php-fpm.d

More related posts