You could earn up to $300 by adding new articles!

Get Started Now

Upgrade to PHP 7.1 on Vultr One-Click LEMP Stack

Published on: Wed, Sep 13, 2017 at 2:02 pm EST

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.

Step 1: Update the system

You don't need to update your server(s). However, it is recommended that you update for a clean environment.

yum -y update

Step 2: Remove PHP

Deletes the previously installed PHP.

yum -y remove php5*

Step 3: Install PHP 7.1

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.

php -v

Step 4: Configure PHP-FPM

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

Open /etc/php-fpm.d/www.conf to modify as follows (around line 23):

user = php-fpm   →  user = nginx
group = php-fpm  →  group = nginx

Step 5: Configure sessions

Change the permissions of the session files.

cd /var/lib/php/fpm
chown nginx:nginx ./ ./*
chmod 777 ./ ./*

Finally, restart nginx and php-fpm.

service php-fpm restart
service nginx restart

Congratulations on installing PHP 7.1!

Want to contribute ?

You could earn up to $300 by adding new articles!

Get started in the SSD Cloud!