I just upgraded this site’s Ubuntu OS from Trusty 14.04 to Xenial 16.04. There are a couple of pitfalls during the upgrade that are noteworthy.
The biggest issue when upgrading to Xenial: Nginx and PHP5-FPM will break when you upgrade. So, keep in mind that any of your sites that rely on PHP5-FPM will be down during the Xenial upgrade.
The second biggest issue: you’ll need to upgrade to PHP7 if you want to use Xenial. There are ways to co-install PHP5.6 with PHP7 on Xenial, but if you absolutely must run PHP5 to support legacy PHP apps, you should consider staying with Ubuntu 14.04.
But why, if Xenial uses PHP7, does Nginx and PHP-5FPM break on upgrade? Because when you issue the do-release-upgrade command, Nginx will silently fail since PHP5-FPM is deprecated in this release, along with PHP5 (because Xenial comes with PHP7). However, PHP7 is not automatically installed when you upgrade.
To fix this, once the upgrade to Xenial is done and the server has rebooted, you need to install PHP7, and then modify your Nginx configuration files to use PHP7-FPM.
To check whether PHP is already installed, and if so which version is installed, enter
php -v. If PHP is installed,
php -i will give you detailed information about your installation.
Installing PHP7 and PHP7-FPM is straightforward. Enter
sudo apt-get install php7.0-fpm php7.0-mysql. If the install worked, the PHP7-FPM service should already be started at the end of the installation.
If you want to be sure that the PHP7-FPM service is running, enter
sudo service php7-fpm stop && sudo service php7-fpm start.
Next, edit your Nginx configuration files and update any parts that reference PHP5-FPM, to use PHP7-FPM.
In a stock setup, the line in question will most likely look like this:
Replace this with:
Note that the location of the PHP7-FPM socket has moved, it now lives in /var/run/php.
Restart Nginx with
sudo service nginx stop && sudo service nginx start. (
sudo service nginx restart/reload probably won’t work here because Nginx won’t be running due to the silent fail).
At this point, if your PHP apps are PHP7-ready, then you should be good to go.