Please may I know how this was resolved? I am about to upgrade from pho7.0.3 to 7.2 on ubuntu 16.4 - I would like to know possible challenges and how to address it
I had good results to install newer/older PHP versions in addition to the default one using phpbrew. You may switch between default and other PHP's in the Virtual Site settings at Server Configuration > PHP Versions.
This is an example how to install PHP 7.1 on Ubuntu 14.04. Should be working for PHP 7.2 too:
Only once - probably different on newer Ubuntu or Debian:
# Path for "zend_extension" in php.ini's / conf.d/*.ini needs to be absolute. # Adopt to your specific PHP version. echo "zend_extension = /opt/phpbrew/php/php-7.1.21/lib/php/extensions/no-debug-non-zts-20160303/opcache.so opcache.enable=1 opcache.enable_cli=1 opcache.interned_strings_buffer=8 opcache.max_accelerated_files=10000 opcache.memory_consumption=128 opcache.save_comments=1 opcache.revalidate_freq=1" | tee /etc/php71/conf.d/opcache.ini
# Optional: Install PECL extensions phpbrew use ${VERSION}
Issue Fixed
Please may I know how this was resolved? I am about to upgrade from pho7.0.3 to 7.2 on ubuntu 16.4 - I would like to know possible challenges and how to address it
MartFame
I had good results to install newer/older PHP versions in addition to the default one using phpbrew. You may switch between default and other PHP's in the Virtual Site settings at Server Configuration > PHP Versions.
This is an example how to install PHP 7.1 on Ubuntu 14.04. Should be working for PHP 7.2 too:
Only once - probably different on newer Ubuntu or Debian:
apt-get install build-essential bison autoconf automake libtool re2c flex autotools-dev \
libxml2-dev libssl-dev libbz2-dev libdb5.1-dev libjpeg-dev libXpm-dev libfreetype6-dev \
libt1-dev libgmp3-dev libldap2-dev libmcrypt-dev libmhash-dev freetds-dev zlib1g-dev \
libmysqlclient-dev libncurses5-dev libpcre3-dev libsqlite0-dev libaspell-dev libreadline6-dev\
librecode-dev libxslt1-dev icu-devtools libexpat1-dev libicu-dev libicu52 libjpeg-turbo8-dev \
libjpeg8-dev libmcrypt4 libpng12-dev m4 zlib1g-dev pkg-config libcurl4-openssl-dev libc-client2007e-dev \
libmagickwand-dev
ln -s /usr/lib/libc-client.a /usr/lib/x86_64-linux-gnu/libc-client.a
Everytime you install/upgrade:
phpbrew self-update
phpbrew update
rm /opt/phpbrew/distfiles/*
rm -rf /opt/phpbrew/build/*
phpbrew install -j 2 7.1 +bcmath +bz2 +calendar +cgi +ctype +exif +fileinfo +filter +dom +ftp +gd +hash +iconv +imap +intl +ipc +json +mbregex \
+mbstring +mcrypt +mhash +mysql +openssl +pcntl +pdo +posix +readline +session +soap +sockets +sqlite +xml_all +zip +zlib -- \
--with-config-file-path=/etc/php71/cgi --with-config-file-scan-dir=/etc/php71/cgi/conf.d --with-mysql-sock=/var/run/mysqld/mysqld.sock \
--with-curl --with-gd --with-png-dir=/usr/lib/x86_64-linux-gnu --with-jpeg-dir=/usr/lib/x86_64-linux-gnu --with-freetype-dir=/usr/include/freetype2 \
--enable-gd-native-ttf --with-xpm-dir=/usr/lib/x86_64-linux-gnu --enable-opcache
rm -f /usr/local/bin/php71*
strip /opt/phpbrew/php/php-7.1.*/bin/php-cgi /opt/phpbrew/php/php-7.1.*/bin/php
# Replace "php-7.1.21" by the installed version.
VERSION="php-7.1.21"
ln /opt/phpbrew/php/${VERSION}/bin/php-cgi /usr/local/bin/php71-cgi
ln /opt/phpbrew/php/${VERSION}/bin/php /usr/local/bin/php71
mkdir -p /etc/php71/cgi /etc/php71/conf.d
cp /opt/phpbrew/php/${VERSION}/etc/php.ini /etc/php71/cgi/php.ini
ln -fs /etc/php71/conf.d /etc/php71/cgi/
# Path for "zend_extension" in php.ini's / conf.d/*.ini needs to be absolute.
# Adopt to your specific PHP version.
echo "zend_extension = /opt/phpbrew/php/php-7.1.21/lib/php/extensions/no-debug-non-zts-20160303/opcache.so
opcache.enable=1
opcache.enable_cli=1
opcache.interned_strings_buffer=8
opcache.max_accelerated_files=10000
opcache.memory_consumption=128
opcache.save_comments=1
opcache.revalidate_freq=1" | tee /etc/php71/conf.d/opcache.ini
# Optional: Install PECL extensions
phpbrew use ${VERSION}
phpbrew ext install apcu
cp /opt/phpbrew/php/${VERSION}/var/db/apcu.ini /etc/php71/conf.d
phpbrew ext install imagick
cp /opt/phpbrew/php/${VERSION}/var/db/imagick.ini /etc/php71/conf.d/imagick.ini
# Only when upgrading - list older Versions...
phpbrew list
# ... and remove it:
phpbrew remove php-7.1.16
service apache2 reload
I don't know what seems more scary... using non-approved repos on CENTOS or this phpbrew on UBUNTU...
In my production environments I like to use stock OS and stock repos and stock PHP, etc.
I need to support different PHP versions at one machine so this is one way to do it. That way I did not run in any PHP-related problems since years.
I wrote a tutorial for this last month, it was tested on Ubuntu 16.04. But should work on Debian 9 too. here it is, How to Use Multiple PHP Versions With Virtualmin and Nginx
I provide FREE Server Management Services in exchange of money