{"id":5611,"date":"2020-04-28T22:44:40","date_gmt":"2020-04-28T19:44:40","guid":{"rendered":"https:\/\/kifarunix.com\/?p=5611"},"modified":"2024-03-14T20:06:04","modified_gmt":"2024-03-14T17:06:04","slug":"install-php-7-4-on-ubuntu-20-04","status":"publish","type":"post","link":"https:\/\/kifarunix.com\/install-php-7-4-on-ubuntu-20-04\/","title":{"rendered":"Install PHP 7.4 on Ubuntu 20.04"},"content":{"rendered":"\n<p>In this guide, we are going to learn how to install <a href=\"https:\/\/www.php.net\/releases\/7_4_0.php\" target=\"_blank\" rel=\"noreferrer noopener\">PHP 7.4<\/a> on Ubuntu 20.04. PHP is a recursive acronym for Hypertext Preprocessor and is a widely-used open source general-purpose scripting language that is especially suited for web development and can be embedded into HTML.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Installing PHP 7.4 on Ubuntu 20.04<\/h2>\n\n\n\n<p>Update and upgrade your system packages;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>apt update\napt upgrade<\/code><\/pre>\n\n\n\n<p>Ubuntu 20.04 ships with PHP 7.4 in its default repos.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>apt show php7.4<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>Package: php7.4\nVersion: 7.4.3-4ubuntu1\nPriority: optional\nSection: php\nOrigin: Ubuntu\nMaintainer: Ubuntu Developers <a href=\"mailto:ubuntu-devel-discuss@lists.ubuntu.com\">ubuntu-devel-discuss@lists.ubuntu.com<\/a>\nOriginal-Maintainer: Debian PHP Maintainers\nBugs: https:\/\/bugs.launchpad.net\/ubuntu\/+filebug\nInstalled-Size: 72.7 kB\nProvides: php\nDepends: libapache2-mod-php7.4 | php7.4-fpm | php7.4-cgi, php7.4-common\nHomepage: http:\/\/www.php.net\/\nDownload-Size: 9,244 B\n<strong>APT-Sources: http:\/\/ke.archive.ubuntu.com\/ubuntu focal\/main amd64 Packages<\/strong><\/code><\/pre>\n\n\n\n<p>Therefore the installation of PHP 7.4 is as simple as running the command below;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>apt install php<\/code><\/pre>\n\n\n\n<p>You can as well use the command;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>apt install php7.4<\/code><\/pre>\n\n\n\n<p>Either of the commands above installs PHP 7.4 on Ubuntu 20.04 along with its dependent packages.<\/p>\n\n\n\n<p>Verifying the version of install PHP on Ubuntu 20.04;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>php -v<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\"><code><strong>PHP 7.4.3<\/strong> (cli) (built: Mar 26 2020 20:24:23) ( NTS )\nCopyright (c) The PHP Group\nZend Engine v3.4.0, Copyright (c) Zend Technologies\n    with Zend OPcache v7.4.3, Copyright (c), by Zend Technologies<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Install PHP 7.4 Modules\/Extensions on Ubuntu 20.04<\/h2>\n\n\n\n<p>Depending on the requirements of your web application, you may need to install extra PHP 7.4 extensions\/modules.<\/p>\n\n\n\n<p>To install the modules\/extensions simply use the command;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>apt install php7.4-<strong>extension<\/strong><\/code><\/pre>\n\n\n\n<p>Where <strong><code>extension<\/code><\/strong> is the name of the module\/extension you are trying to install.<\/p>\n\n\n\n<p>For example, you want to install the following PHP modules;<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Bcmath module for PHP<\/li>\n\n\n\n<li>bzip2 module for PHP<\/li>\n\n\n\n<li>IMAP module for PHP<\/li>\n\n\n\n<li>Internationalisation module for PHP<\/li>\n\n\n\n<li>MBSTRING module for PHP<\/li>\n\n\n\n<li>SOAP module for PHP<\/li>\n\n\n\n<li>Sybase module for PHP<\/li>\n\n\n\n<li>XSL module for PHP<\/li>\n\n\n\n<li>Zip module for PHP<\/li>\n<\/ul>\n\n\n\n<p>You would simply execute the command below to install them;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>apt install php7.4-{bcmath,bz2,imap,intl,mbstring,soap,sybase,xsl,zip}<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Verifying PHP Version and Modules from Browser<\/h3>\n\n\n\n<p>You can also be able to verify version of install PHP and its modules via the browser. For this, you need a web server. Apache2 is installed by default as a dependency package for PHP.<\/p>\n\n\n\n<p>Hence, start Apache and open port 80\/TCP on firewall to allow external access.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>systemctl enable --now apache2<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>ufw allow Apache<\/code><\/pre>\n\n\n\n<p>Next, create a PHP test page on your default web root directory as shown below;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>echo \"&lt;?php phpinfo(); ?&gt;\" &gt; \/var\/www\/html\/index.php<\/code><\/pre>\n\n\n\n<p>Then navigate to the address, <code><strong>http:\/\/your-server\/index.php<\/strong><\/code> on you browser.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"847\" height=\"687\" src=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2020\/04\/php7.4.png\" alt=\"\" class=\"wp-image-5612\" title=\"\" srcset=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2020\/04\/php7.4.png?v=1588102759 847w, https:\/\/kifarunix.com\/wp-content\/uploads\/2020\/04\/php7.4-768x623.png?v=1588102759 768w\" sizes=\"(max-width: 847px) 100vw, 847px\" \/><\/figure>\n\n\n\n<p>And that is how simple it is to installing PHP 7.4 on Ubuntu 20.04.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Related Tutorials<\/h3>\n\n\n\n<p><a rel=\"noreferrer noopener\" href=\"https:\/\/kifarunix.com\/install-php-7-4-on-freebsd-12\/\" target=\"_blank\">Install PHP 7.4 on FreeBSD 12<\/a><\/p>\n\n\n\n<p><a href=\"https:\/\/kifarunix.com\/install-php-7-4-on-centos-8\/\" target=\"_blank\" rel=\"noreferrer noopener\">Install PHP 7.4 on CentOS 8<\/a><\/p>\n\n\n\n<p><a rel=\"noreferrer noopener\" href=\"https:\/\/kifarunix.com\/install-php-7-4-on-debian-10-debian-9\/\" target=\"_blank\">Install PHP 7.4 on Debian 10\/Debian 9<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this guide, we are going to learn how to install PHP 7.4 on Ubuntu 20.04. PHP is a recursive acronym for Hypertext Preprocessor and<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"rank_math_lock_modified_date":false,"footnotes":""},"categories":[121,342],"tags":[1502,1503,1132,1501,1200],"class_list":["post-5611","post","type-post","status-publish","format-standard","hentry","category-howtos","category-php","tag-install-php-7-4-on-ubuntu-20-04","tag-install-php-7-4-ubuntu","tag-php-7-4","tag-php-7-4-ubuntu-20-04","tag-ubuntu-20-04","generate-columns","tablet-grid-50","mobile-grid-100","grid-parent","grid-50"],"_links":{"self":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts\/5611"}],"collection":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/comments?post=5611"}],"version-history":[{"count":4,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts\/5611\/revisions"}],"predecessor-version":[{"id":21352,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts\/5611\/revisions\/21352"}],"wp:attachment":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/media?parent=5611"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/categories?post=5611"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/tags?post=5611"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}