We’ll show you how to install PHP 7.1 with Nginx on Ubuntu 16.04. PHP 7.1 comes with many new features and improvements and as a result of this many developers are using it for their projects. Installing PHP 7.1 with Nginx on an Ubuntu 16.04 VPS, is an easy task, just follow the steps below and you should have it done in a few minutes.
For more updates, you can also consider reading our post on how to install PHP 8 on Ubuntu 20.04
Table of Contents
Step 1: Enable PPA
First of all, connect to your Linux VPS via SSH and enable the Ondrej’s PPA:
Step 2: Install PHP 7.1
Once you enable the PPA you can proceed and install PHP 7.1 using the following command:
Step 3: Search and install specific PHP 7.1 modules
This will also install the required dependencies too. However, if you want to install specific PHP7.1 module, you can search if it is available using the following command:
Step 4: Install most commonly used modules
To install PHP7.1 including some of the most commonly used modules you can use the following command:
Step 5: Configure php.ini file
Once the installation is completed you need to edit the php.ini
file. Find the configuration file:
Edit the file using your favorite text editor:
Make the following changes:
Then, restart the PHP-FPM service:
Step 6: Install Nginx on Ubuntu 16.04
Installing Nginx on Ubuntu VPS is very easy. Run the following command to install it:
Create Nginx virtual server block for your domain name:
Paste the following content:
Of course, you should replace example.com with your actual domain name. Save and close the file. To enable the server block in Nginx you need to create a symbolic link to site-enabled
. Use the following command to create a symbolic link:
Check if there are errors with the configuration:
If the syntax is OK and there are no errors you can restart Nginx.
Enable Nginx and PHP-FPM on system boot:
7. Further steps
After you’ve installed PHp 7.1 and Nginx on your Linux VPS, you can follow our guide on how to secure your LEMP stack.
You can also get optimized LEMP hosting from us and we’ll install, configure and optimize PHP 7.1 and Nginx on your VPS, free of charge.
Of course you don’t have to do any of this if you use one of our Blazing Fast VPS Hosting services, in which case you can simply ask our expert Linux admins to install PHP 7.1 and Nginx on Ubuntu 16.04, for you. They are available 24×7 and will take care of your request immediately.
PS. If you liked this post, on how to install PHP 7.1 with Nginx on Ubuntu 16.04, please share it with your friends on social networks on the left or simply leave a reply below. Thanks.
Good post.