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
$ 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.
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.