Support & Downloads

Quisque actraqum nunc no dolor sit ametaugue dolor. Lorem ipsum dolor sit amet, consyect etur adipiscing elit.

s f

Contact Info
198 West 21th Street, Suite 721
New York, NY 10010
[email protected]
+88 (0) 101 0000 000
phpCustomersinMagento2

How to Install Different PHP (5.6, 7.0 and 7.1) Versions in Ubuntu

PHP (recursive acronym for PHP: Hypertext Preprocessor) is an open source, popular general-purpose scripting language that is widely-used and best suited for developing websites and web-based applications. It is a server-side scripting language that can be embedded in HTML.

Currently, there are three supported versions of PHP, i.e PHP 5.67.0 and 7.1. Meaning PHP 5.35.4 and 5.5 have all reached end of life; they are no longer supported with security updates.

In this article, we will explain how to install all the supported versions of PHP in Ubuntu and its derivatives with most requested PHP extensions for both Apache and Nginx web servers using a Ondřej Surý PPA. We will also explain how to set default version of PHP to be used on the Ubuntu system.

Note that PHP 7.x is the supported stable version in the Ubuntu software repositories, you can confirm this by running the apt command below.

To install the default PHP version from the Ubuntu software repositories, use the command below.

2. Next, update the system as follows.

3. Now install different supported versions of PHP as follows.

For Apache Web Server

For Nginx Web Server

4. To install any PHP modules, simply specify the PHP version and use the auto-completion functionality to view all modules as follows.

5. Now you can install most required PHP modules from the list..

Set Default PHP Version in Ubuntu

7. You can set the default PHP version to be used on the system with the update-alternatives command, after setting it, check the PHP version to confirm as follows.

8. To set the PHP version that will work with Apache web server, use the commands below. First disable the current version with the a2dismod command and then enable the one you want with the a2enmod command.

9. After switching from one version to another, you can find your PHP configuration file, by running the command below.

In this article, we showed how to install all the supported versions of PHP in Ubuntu and its derivatives. If you have any queries or thoughts to share, do so via the feedback form below.

Sagar Doshi

CEO / Managing Partner

[email protected]

Post a Comment