How to install php 7.4 on Ubuntu 20.04
To Ensure system updated.
apt update
If any update is available update the system and reboot.
apt upgrade -y && reboot
Add PHP PPA Repository
apt -y install software-properties-common
add-apt-repository ppa:ondrej/php
Output:
root@vps:~# add-apt-repository ppa:ondrej/php
Co-installable PHP versions: PHP 5.6, PHP 7.x and most requested extensions are included. Only Supported Versions of PHP (http://php.net/supported-versions.php) for Supported Ubuntu Releases (https://wiki.ubuntu.com/Releases) are provided. Don't ask for end-of-life PHP versions or Ubuntu release, they won't be provided.
Debian oldstable and stable packages are provided as well: https://deb.sury.org/#debian-dpa
You can get more information about the packages at https://deb.sury.org
BUGS&FEATURES: This PPA now has a issue tracker:
https://deb.sury.org/#bug-reporting
Install PHP 7.4 on Ubuntu
Ensure the added package is up to date.
apt update
If any update is available update the system and reboot.
apt upgrade -y && reboot
Install PHP 7.4 on Ubuntu
apt -y install php7.4
Output:
root@vps:~# apt -y install php7.4
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
amd64-microcode intel-microcode iucode-tool
Use 'apt autoremove' to remove them.
The following additional packages will be installed:
apache2 apache2-bin apache2-data apache2-utils libapache2-mod-php7.4 libapr1
libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap liblua5.2-0
libpcre2-8-0 libsodium23 php-common php7.4-cli php7.4-common php7.4-json
php7.4-opcache php7.4-readline ssl-cert
Once you have installed PHP, check the PHP version.
php -v
Output:
root@vps:~# php -v
PHP 7.4.6 (cli) (built: May 14 2020 10:02:44) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
with Zend OPcache v7.4.6, Copyright (c), by Zend Technologies
To Install php Extensions.
NOTE: Replace the required extensions name in the command
apt install php7.4-<extension>
To list installed php modules/extensions.
php -m
This concludes our topic of installing PHP 7.4 on the Ubuntu 20.04 system.
CrownCloud - Get a SSD powered KVM VPS at $4.5/month!
Use the code WELCOME
for 10% off!
1 GB RAM / 25 GB SSD / 1 CPU Core / 1 TB Bandwidth per month
Available Locations: LAX | MIA | ATL | FRA | AMS