This guide explains how to upgrade from PHP 5.6 to version 7.1 on the Vultr one-click LEMP stack. This tutorial is only applicable if your application is running PHP 5.6. PHP 7.1 was released on December 1, 2016. Steps in this guide will work for other one-click applications as well, but be warned, additional configuration for those applications may also be needed.
Before proceeding, you need to log into your server as root or a sudo user.
You don't need to update your server(s). However, it is recommended that you update for a clean environment.
yum -y update
Deletes the previously installed PHP.
yum -y remove php5*
Install the following packages.
yum -y install php71u-cli.x86_64 php71u-common.x86_64 php71u-fpm.x86_64 php71u-gd.x86_64 php71u-mbstring.x86_64 php71u-mcrypt.x86_64 php71u-mysqlnd.x86_64 php71u-opcache.x86_64 php71u-pdo.x86_64 php71u-process.x86_64 php71u-xml.x86_64 php71u-xmlrpc.x86_64 php71*json
Run the command below to ensure that they have been properly installed.
Let's change the PHP-FPM settings to resolve several issues.
Enter the command below to set the server to run automatically when the server reboots.
chkconfig php-fpm on
/etc/php-fpm.d/www.conf to modify as follows (around line 23):
user = php-fpm → user = nginx group = php-fpm → group = nginx
Change the permissions of the session files.
cd /var/lib/php/fpm chown nginx:nginx ./ ./* chmod 777 ./ ./*
service php-fpm restart service nginx restart
Congratulations on installing PHP 7.1!