Learn How To Upgrade to PHP 7.1 on One-Click LEMP Stack
Table of Contents
- Step 1: Update the system
- Step 2: Remove PHP
- Step 3: Install PHP 7.1
- Step 4: Configure PHP-FPM
- Step 5: Configure sessions
This guide explains how to upgrade from PHP 5.6 to version 7.1 on the IT Web Services 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.
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
/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 ./ ./*
service php-fpm restart service nginx restart
Congratulations on installing PHP 7.1!
Do you need help setting up this on your own service?
Please contact us and we’ll provide you the best possible quote!