In this KB
- PHP 7 compatibility with Debian OS
- How to upgrade your server to PHP 7 in three steps
- How to verify your PHP 7 version
This guide will assist you on how to upgrade your server to PHP 7. Please note that PHP 7 is compatible with Debian 8, and it does not work with older OS.
If you have recently launched a server at Cloudways, then you have Debian 8 Jessie as the OS with PHP 5.6 as the default PHP version. For customers who launched their servers on or before the 9th of February, 2016, you can follow this guide to upgrade the version from Debian 7 Wheezy to Debian 8 Jessie Server.
Note: Before you upgrade your application to PHP 7, we recommend you to go through this guide where we have explained about PHP 7 compatibility with different applications and services.
Step 1: Select Server
Log into the Cloudways Platform with your credentials. Click on Servers in the top menu bar. Then, click on your target server from the list that you need to update to PHP 7.
Step 2: Upgrade to PHP 7
Before upgrading the PHP version, please make sure that your applications hosted on the server are compatible with PHP7. Otherwise, your web applications may break due to this.
To see the limitations of PHP 7 and supported apps, please visit this guide.
Now, under the Server Management area, navigate to the Settings & Packages section and the Packages tab. Select PHP 7.0 from the drop down menu and click on the Save button.
You will see a warning popup message. Click on the OK button to initiate the process if your application(s) is fully compatible.
It takes a few moments to upgrade the package.
When the process has completed, you should have PHP7 on your server. We strongly advise you to check your web applications with this upgraded PHP version. If you want, you can revert to PHP version 5.6 from the Settings & Packages section.
Step 3: Verify PHP Version
To verify the PHP version, you can type PHP -v via SSH on your server, OR you can create a new file under your web root directory and name it info.php. Open the file in nano or vi editor and paste the following code:
<span style="font-weight: 400;"><?php</span>
<span style="font-weight: 400;">phpinfo();</span>
<span style="font-weight: 400;">?></span>
Close the editor and save info.php file. After that, open your application URL in your browser, such as www.your-app-url.com/info.php (replace your-app-URL with your application URL address). You should see the PHP version and its configuration information.