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 support article guides 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 article 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 article where we have explained about PHP 7 compatibility with different applications and services.
Step 1: Login to Cloudways Platform
Go to https://platform.cloudways.com/login and sign in with your credentials.
Step 2: Select Server
Tap on “Servers” on the top menu bar and then select desired server on which you need to update PHP 7.
Step 3: 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 article.
Now, under “Server Management” page, find “Settings & Packages.” Select PHP 7.0 from the drop down menu and click on the “Save” button.
It displays a warning popup message, click on “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 the PHP version to 5.6 from the same option i.e. “Settings & Packages”.
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, e.g. 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.