Here is how you can quickly update PHP 7.0 to 7.1 on a Vultr Ubuntu domain.
I have configured a number of Vultr domains with NGINX and PHP 7.1 FPM and today I realised I need to update PHP 7.0 to 7.1 to fix a few security exploits (read more here and here on securing Ubuntu in the cloud). PHP has a good page where you can keep up to date with PHP news here https://secure.php.net/. You can also view the PHP bug tracker to view bugs here. PHP aggregation user @php_net on twitter is good to follow, the official PHP twitter account is @official_php.
I have not noticed in daily Ubuntu package updates no option to update PHP 7.0 to 7.1, I must have to update manually.
WARNING: Backup your site and test this on a non-production server before doing it on a live server. I had an issue with PHP 7.1 breaking WordPress 3.9 (MySQL issues with some plugins) and I had to roll back to 7.0 (see rollback tips in troubleshooting below). WordPress says it is PHP 7.1 compatible but issues exist. WordPress 3.9 ditches “mysql” and used “mysqli” and when instead PHP 7.1 WordPress could not find “mysqli”?
List packages with updates
You can run the following to view upgradable packages (TIP: Backup NGINX and other configuration files before any upgrades).
Update your server packages
Reboot
You should now see this on startup
You can view your installed PHP configuration file and installed version by typing to following in your servers command line.
Now let’s install a package viewer
Search installed packages (or non-installed) PHP packages.
Uninstall all local PHP related packages
Confirm packages are uninstalled
Install PHP 7.1 and common packages
Verify PHP 7.1 installation
Reboot
See if the PHP 7.1 FPM service has started
sudo systemctl | grep php > php7.1-fpm.service
Restart PHP 7.1 FPM Service
Edit your /etc/nginx/sites-enabled/default and change the fastcgi_pass from “7.0” to “7.1”
Edits:
Reload NGINX configuration and restart NGINX
Your website should now be back up and running PHP 7.1
Post Install Tasks
View this blog post on other useful linux commands.
Edit your PHP.ini file and add required changes (e.g upload sizes).
sudo nano /etc/php/7.1/fpm/php.ini # upload_max_filesize = 2M + upload_max_filesize = 8M
Troubleshooting
View PHP configuration values (add this to a debug.php and load in in a browser)
<?php // Show all information, defaults to INFO_ALL phpinfo(); // Show just the module information. // phpinfo(8) yields identical results. phpinfo(INFO_MODULES); ?>
I broke my WordPress 3.9 when I tried to update to PHP 7.1 so I rolled back to 7.0.
Google help had me stuck for a while when I had issues purging php 7.1.
Because my blog (with install steps) was down I used this site to help be find the commands to run.
Conclusion
Sometimes going with cutting edge tech you will go out on a limb, ensure you know and can restore a working site if need be.
Always have a backup and restore plan.
Hope this guide helps.
Donate and make this blog better
Ask a question or recommend an article
[contact-form-7 id=”30″ title=”Ask a Question”]
v1.35 WordPress 3.9 error with PHP 7.1