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.

Đang xem: Installing apache 2, php 5

Currently, there are three supported versions of PHP, i.e PHP 5.6, 7.0, and 8.0. Meaning PHP 5.3, 5.4, and 5.5 have all reached the 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 the most requested PHP extensions for both Apache and Nginx web servers using an Ondřej Surý PPA. We will also explain how to set the 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.

$ sudo apt show phpOR$ sudo apt show php -a
Show PHP Version Information
Package: phpVersion: 1:7.0+35ubuntu6Priority: optionalSection: phpSource: php-defaults (35ubuntu6)Origin: UbuntuMaintainer: Ubuntu Developers >Original-Maintainer: Debian PHP Maintainers >Bugs: https://bugs.launchpad.net/ubuntu/+filebugInstalled-Size: 11.3 kBDepends: php7.0Supported: 5yDownload-Size: 2,832 BAPT-Sources: http://archive.ubuntu.com/ubuntu xenial/main amd64 PackagesDescription: server-side, HTML-embedded scripting language (default) PHP (recursive acronym for PHP: Hypertext Preprocessor) is a widely-used open source general-purpose scripting language that is especially suited for web development and can be embedded into HTML. . This package is a dependency package, which depends on Debian”s default PHP version (currently 7.0).To install the default PHP version from the Ubuntu software repositories, use the command below.

Xem thêm:

$ sudo apt install php

Install PHP (5.6, 7.x, 8.0) on Ubuntu Using PPA

1. First start by adding Ondřej Surý PPA to install different versions of PHP – PHP 5.6, PHP 7.x, and PHP 8.0 on the Ubuntu system.

$ sudo apt install python-software-properties$ sudo add-apt-repository ppa:ondrej/php

*
*
*
*
*
*
*
*

Find PHP Configuration FileYou may also like:

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.

Xem thêm:

If you liked this article, then do subscribe to email alerts for Linux tutorials. If you have any questions or doubts? do ask for help in the comments section.

Related Post

Leave a Reply

Your email address will not be published. Required fields are marked *