{"id":236,"date":"2021-01-05T15:28:38","date_gmt":"2021-01-05T09:58:38","guid":{"rendered":"http:\/\/192.168.0.6\/linuxbots\/?p=236"},"modified":"2025-07-08T18:54:22","modified_gmt":"2025-07-08T13:24:22","slug":"install-php-in-ubuntu-18-04","status":"publish","type":"post","link":"https:\/\/itsupportwale.com\/blog\/install-php-in-ubuntu-18-04\/","title":{"rendered":"How To Install PHP in Ubuntu 18.04 LTS"},"content":{"rendered":"\n<p>Current Stable Release of PHP is 7.4.1 released on 18 December 2019. In this article, we learn how to install the latest PHP 7.4 in Ubuntu Server. PHP 7.4.1 is available for production environments and you can install it via the <strong><a rel=\"noreferrer noopener\" aria-label=\"Ondrej PPA (opens in a new tab)\" href=\"https:\/\/launchpad.net\/~ondrej\/+archive\/ubuntu\/php\" target=\"_blank\">Ondrej PPA<\/a><\/strong> repository. However, you can install the older versions of PHP using this repository including versions 7.2 and 7.3.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"800\" height=\"532\" src=\"https:\/\/oracle.itsupportwale.com\/blog\/wp-content\/uploads\/2019\/12\/install-php-7.4-ubuntu-server-1.jpg\" alt=\"install-php-7.4-ubuntu-server\" class=\"wp-image-3460\" srcset=\"https:\/\/itsupportwale.com\/blog\/wp-content\/uploads\/2019\/12\/install-php-7.4-ubuntu-server-1.jpg 800w, https:\/\/itsupportwale.com\/blog\/wp-content\/uploads\/2019\/12\/install-php-7.4-ubuntu-server-1-300x200.jpg 300w, https:\/\/itsupportwale.com\/blog\/wp-content\/uploads\/2019\/12\/install-php-7.4-ubuntu-server-1-768x511.jpg 768w\" sizes=\"auto, (max-width: 800px) 100vw, 800px\" \/><\/figure>\n\n\n\n<p>PHP is one of the most used programming languages on the internet. Make sure you get the latest version installed for security and bug fixes. You can check here, what are the latest security vulnerabilities in PHP.<\/p>\n\n\n\n<p>PHP is a very popular Server Side Scripting Language best known for interactive web pages and dynamic websites. We will learn the installation of PHP 7.4 in some simple steps. Just follow the below steps for installing PHP 7.4 on Ubuntu Server.<\/p>\n\n\n\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_80 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<label for=\"ez-toc-cssicon-toggle-item-69d80a6f9cc40\" class=\"ez-toc-cssicon-toggle-label\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/label><input type=\"checkbox\"  id=\"ez-toc-cssicon-toggle-item-69d80a6f9cc40\"  aria-label=\"Toggle\" \/><nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/itsupportwale.com\/blog\/install-php-in-ubuntu-18-04\/#Step_1_Add_Ondrej_PHP_PPA_Repository\" >Step 1: Add Ondrej PHP PPA Repository<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/itsupportwale.com\/blog\/install-php-in-ubuntu-18-04\/#Step_2_Install_the_latest_PHP_version_in_Ubuntu_1804\" >Step 2: Install the latest PHP version in Ubuntu 18.04<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/itsupportwale.com\/blog\/install-php-in-ubuntu-18-04\/#Installing_the_PHP_74_with_Apache_Webserver\" >Installing the PHP 7.4 with Apache Webserver<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/itsupportwale.com\/blog\/install-php-in-ubuntu-18-04\/#Installing_the_PHP_74_with_Nginx\" >Installing the PHP 7.4 with Nginx<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/itsupportwale.com\/blog\/install-php-in-ubuntu-18-04\/#Step_3_Verify_PHP_installation\" >Step 3: Verify PHP installation<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/itsupportwale.com\/blog\/install-php-in-ubuntu-18-04\/#Install_PHP_73_in_Ubuntu_1804\" >Install PHP 7.3 in Ubuntu 18.04<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/itsupportwale.com\/blog\/install-php-in-ubuntu-18-04\/#Install_PHP_72_in_Ubuntu_1804\" >Install PHP 7.2 in Ubuntu 18.04<\/a><\/li><\/ul><\/nav><\/div>\n<h2 class=\"wp-block-heading\" id=\"h-step-1-add-ondrej-php-ppa-repository\"><span class=\"ez-toc-section\" id=\"Step_1_Add_Ondrej_PHP_PPA_Repository\"><\/span>Step 1: Add Ondrej PHP PPA Repository<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>All the Ubuntu supported PHP build packages are present in ppa:ondrej\/php&nbsp;PPA repository. You can add it by using the below command.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt -y install software-properties-common\nsudo add-apt-repository ppa:ondrej\/php\nsudo apt-get update<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-step-2-install-the-latest-php-version-in-ubuntu-18-04\"><span class=\"ez-toc-section\" id=\"Step_2_Install_the_latest_PHP_version_in_Ubuntu_1804\"><\/span>Step 2: Install the latest PHP version in Ubuntu 18.04<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>The Ondrej PPA repository is having all the supported PHP packages for ubuntu. So that you can install any version of PHP using this repository. <\/p>\n\n\n\n<p>You can also see the available versions of PHP by using the below command.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt list | grep php<\/code><\/pre>\n\n\n\n<p>But in the article, we install the latest PHP 7.4 by using the below command.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt-get -y install php7.4<\/code><\/pre>\n\n\n\n<p>After that, You get the latest PHP 7.4 installed in Ubuntu Server. To see the version of installed PHP, use the below command.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>php -v<\/code><\/pre>\n\n\n\n<p>You will see the output as below<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">root@linuxbots:~# php -v\n PHP 7.4.1 (cli) (built: Dec 18 2019 14:44:04) ( NTS )\n Copyright (c) The PHP Group\n Zend Engine v3.4.0, Copyright (c) Zend Technologies\n     with Zend OPcache v7.4.1, Copyright (c), by Zend Technologies<\/pre>\n\n\n\n<p>After that, you can install the additional packages of PHP by using the below command.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt-get install php7.4-xxx<\/code><\/pre>\n\n\n\n<p>Replace xxx with the package name. For example, if you want to install the PHP JSON package then you should run the following command.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt-get -y install php7.4-json<\/code><\/pre>\n\n\n\n<p>Or you can install multiple packages with a single command like below.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt-get install -y php7.4-{mysql,mbstring,json,gd,bz2,bcmath}<\/code><\/pre>\n\n\n\n<p>All the PHP related configuration of apache server will exist in <code>\/etc\/php\/7.4\/apache2\/php.ini<\/code><\/p>\n\n\n\n<p>Installing the PHP 7.4 with Nginx<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-installing-the-php-7-4-with-apache-webserver\"><span class=\"ez-toc-section\" id=\"Installing_the_PHP_74_with_Apache_Webserver\"><\/span>Installing the PHP 7.4 with Apache Webserver<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>If you are willing to install PHP with Apache Web Server, then you have to install the PHP module for apache. Install the PHP module for Apache using the below command.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt install php libapache2-mod-php<\/code><\/pre>\n\n\n\n<p>After installation, restart the Apache webserver by using the below command.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo systemctl restart apache2<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-installing-the-php-7-4-with-nginx\"><span class=\"ez-toc-section\" id=\"Installing_the_PHP_74_with_Nginx\"><\/span>Installing the PHP 7.4 with Nginx<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>The default installation of PHP is configured for the Apache Web Server. If you want to install the PHP 7.4 with Nginx, you have to stop and disable the service of Apache Web Server. You can do it by below command.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo systemctl disable --now apache2<\/code><\/pre>\n\n\n\n<p>Now we install PHP-FPM with Nginx. By running below command.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt-get -y install php7.4-fpm nginx<\/code><\/pre>\n\n\n\n<p>Now start and enable the PHP-FPM and Nginx services By running below command.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>systemctl start php7.4-fpm\nsystemctl start nginx\nsystemctl enable php7.4-fpm\nsystemctl enable nginx<\/code><\/pre>\n\n\n\n<p>You can verify that both services are running by using the below command.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>systemctl status php7.4-fpm\nsystemctl status nginx<\/code><\/pre>\n\n\n\n<p>All the PHP related configuration is present in <code>\/etc\/php\/7.4\/fpm\/pool.d\/www.conf<\/code><\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-step-3-verify-php-installation\"><span class=\"ez-toc-section\" id=\"Step_3_Verify_PHP_installation\"><\/span>Step 3: Verify PHP installation<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>To verify the successful installation of PHP in our Ubuntu 18.04, We just create a new file in our server&#8217;s root directory which is by default <strong>\/var\/www\/html\/<\/strong>. We create a PHP file with any name, For this tutorial we create the file with the name test.php and enter the following PHP code in that file.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;?php\n\n\/\/ Show all information, defaults to INFO_ALL\nphpinfo();\n\n?&gt;<\/code><\/pre>\n\n\n\n<p>After that, save the file and point your browser to that file Using this URL <strong>http:\/\/mydoman\/test.php <\/strong>Here replace the <strong>mydomain<\/strong> by your domain name or IP address.<\/p>\n\n\n\n<p>You will the page like the below image.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"866\" height=\"595\" src=\"https:\/\/oracle.itsupportwale.com\/blog\/wp-content\/uploads\/2019\/12\/install-php-on-Ubuntu-18.04.jpg\" alt=\"install-php-on-Ubuntu-18.04\" class=\"wp-image-3461\" srcset=\"https:\/\/itsupportwale.com\/blog\/wp-content\/uploads\/2019\/12\/install-php-on-Ubuntu-18.04.jpg 866w, https:\/\/itsupportwale.com\/blog\/wp-content\/uploads\/2019\/12\/install-php-on-Ubuntu-18.04-300x206.jpg 300w, https:\/\/itsupportwale.com\/blog\/wp-content\/uploads\/2019\/12\/install-php-on-Ubuntu-18.04-768x528.jpg 768w\" sizes=\"auto, (max-width: 866px) 100vw, 866px\" \/><\/figure>\n\n\n\n<p>That&#8217;s it, you have the latest stable PHP 7.4 install and running now.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-install-php-7-3-in-ubuntu-18-04\"><span class=\"ez-toc-section\" id=\"Install_PHP_73_in_Ubuntu_1804\"><\/span>Install PHP 7.3 in Ubuntu 18.04<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>If you want to install the older version of PHP. Just follow the below steps to install PHP 7.3 in Ubuntu 18.04.<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>Enable the Ondrej PHP repository:<\/strong><\/li><\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt -y install software-properties-common\nsudo add-apt-repository ppa:ondrej\/php\nsudo apt-get update<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>Install PHP 7.3 along with some common extensions.<\/strong><\/li><\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt-get install -y php7.3 php7.3-{mysql,mbstring,json,gd,bz2,bcmath}<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>Verify the installation using the below command<\/strong><\/li><\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>php -v<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-install-php-7-2-in-ubuntu-18-04\"><span class=\"ez-toc-section\" id=\"Install_PHP_72_in_Ubuntu_1804\"><\/span>Install PHP 7.2 in Ubuntu 18.04<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>PHP 7.2 is the default version of PHP which comes with Ubuntu 18.04 LTS. We do not need to enable the <strong>Ondrej PHP repository<\/strong> for installing PHP 7.2.<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>Install PHP 7.2 along with some common extensions.<\/strong><\/li><\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt-get install -y php7.2 php7.2-{mysql,mbstring,json,gd,bz2,bcmath}<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>Verify the installation using the below command<\/strong><\/li><\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>php -v<\/code><\/pre>\n\n\n\n<p>Conclusion:<\/p>\n\n\n\n<p>In the article, we learned how to install PHP in Ubuntu 18.04. If you face any problem in following this article then you can mention it in the comment section.<\/p>\n\n\n\n<p>Also Read: <a href=\"https:\/\/oracle.itsupportwale.com\/blog\/install-openlitespeed-on-ubuntu-16\/\" target=\"_blank\" rel=\"noreferrer noopener\" label=\"How To Install OpenLiteSpeed Web Server on Ubuntu 16.04 LTS (opens in a new tab)\">How To Install OpenLiteSpeed Web Server on Ubuntu 16.04 LTS<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Current Stable Release of PHP is 7.4.1 released on 18 December 2019. In this article, we learn how to install the latest PHP 7.4 in Ubuntu Server. PHP 7.4.1 is available for production environments and you can install it via the Ondrej PPA repository. However, you can install the older versions of PHP using this &#8230; <a title=\"How To Install PHP in Ubuntu 18.04 LTS\" class=\"read-more\" href=\"https:\/\/itsupportwale.com\/blog\/install-php-in-ubuntu-18-04\/\" aria-label=\"Read more  on How To Install PHP in Ubuntu 18.04 LTS\">Read more<\/a><\/p>\n","protected":false},"author":2,"featured_media":3460,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[498,500,258,504,2],"tags":[533,559,8,248,9],"class_list":["post-236","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-foss","category-linux","category-php","category-tutorial","category-tutorials","tag-latest-php","tag-php-7-4","tag-ubuntu","tag-ubuntu-16-04","tag-ubuntu-18-04"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.0 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How To Install PHP in Ubuntu 18.04 LTS - ITSupportWale<\/title>\n<meta name=\"description\" content=\"In this article, we learn how to install PHP in Ubuntu 18.04 LTS. You can install the latest PHP 7.4 or the older versions 7.3 or 7.2 by this method.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/itsupportwale.com\/blog\/install-php-in-ubuntu-18-04\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How To Install PHP in Ubuntu 18.04 LTS - ITSupportWale\" \/>\n<meta property=\"og:description\" content=\"In this article, we learn how to install PHP in Ubuntu 18.04 LTS. You can install the latest PHP 7.4 or the older versions 7.3 or 7.2 by this method.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/itsupportwale.com\/blog\/install-php-in-ubuntu-18-04\/\" \/>\n<meta property=\"og:site_name\" content=\"ITSupportWale\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/Itsupportwale-298547177495978\" \/>\n<meta property=\"article:published_time\" content=\"2021-01-05T09:58:38+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-07-08T13:24:22+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/itsupportwale.com\/blog\/wp-content\/uploads\/2019\/12\/install-php-7.4-ubuntu-server-1.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"800\" \/>\n\t<meta property=\"og:image:height\" content=\"532\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Techie\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Techie\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/itsupportwale.com\/blog\/install-php-in-ubuntu-18-04\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/itsupportwale.com\/blog\/install-php-in-ubuntu-18-04\/\"},\"author\":{\"name\":\"Techie\",\"@id\":\"https:\/\/itsupportwale.com\/blog\/#\/schema\/person\/8c5a2b3d36396e0a8fd91ec8242fd46d\"},\"headline\":\"How To Install PHP in Ubuntu 18.04 LTS\",\"datePublished\":\"2021-01-05T09:58:38+00:00\",\"dateModified\":\"2025-07-08T13:24:22+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/itsupportwale.com\/blog\/install-php-in-ubuntu-18-04\/\"},\"wordCount\":703,\"commentCount\":2,\"publisher\":{\"@id\":\"https:\/\/itsupportwale.com\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/itsupportwale.com\/blog\/install-php-in-ubuntu-18-04\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/itsupportwale.com\/blog\/wp-content\/uploads\/2019\/12\/install-php-7.4-ubuntu-server-1.jpg\",\"keywords\":[\"latest php\",\"php 7.4\",\"ubuntu\",\"ubuntu 16.04\",\"ubuntu 18.04\"],\"articleSection\":[\"FOSS\",\"Linux\",\"php\",\"Tutorial\",\"Tutorials\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/itsupportwale.com\/blog\/install-php-in-ubuntu-18-04\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/itsupportwale.com\/blog\/install-php-in-ubuntu-18-04\/\",\"url\":\"https:\/\/itsupportwale.com\/blog\/install-php-in-ubuntu-18-04\/\",\"name\":\"How To Install PHP in Ubuntu 18.04 LTS - ITSupportWale\",\"isPartOf\":{\"@id\":\"https:\/\/itsupportwale.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/itsupportwale.com\/blog\/install-php-in-ubuntu-18-04\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/itsupportwale.com\/blog\/install-php-in-ubuntu-18-04\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/itsupportwale.com\/blog\/wp-content\/uploads\/2019\/12\/install-php-7.4-ubuntu-server-1.jpg\",\"datePublished\":\"2021-01-05T09:58:38+00:00\",\"dateModified\":\"2025-07-08T13:24:22+00:00\",\"description\":\"In this article, we learn how to install PHP in Ubuntu 18.04 LTS. You can install the latest PHP 7.4 or the older versions 7.3 or 7.2 by this method.\",\"breadcrumb\":{\"@id\":\"https:\/\/itsupportwale.com\/blog\/install-php-in-ubuntu-18-04\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/itsupportwale.com\/blog\/install-php-in-ubuntu-18-04\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/itsupportwale.com\/blog\/install-php-in-ubuntu-18-04\/#primaryimage\",\"url\":\"https:\/\/itsupportwale.com\/blog\/wp-content\/uploads\/2019\/12\/install-php-7.4-ubuntu-server-1.jpg\",\"contentUrl\":\"https:\/\/itsupportwale.com\/blog\/wp-content\/uploads\/2019\/12\/install-php-7.4-ubuntu-server-1.jpg\",\"width\":800,\"height\":532,\"caption\":\"install-php-7.4-ubuntu-server\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/itsupportwale.com\/blog\/install-php-in-ubuntu-18-04\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/itsupportwale.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How To Install PHP in Ubuntu 18.04 LTS\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/itsupportwale.com\/blog\/#website\",\"url\":\"https:\/\/itsupportwale.com\/blog\/\",\"name\":\"ITSupportWale\",\"description\":\"Tips, Tricks, Fixed-Errors, Tutorials &amp; Guides\",\"publisher\":{\"@id\":\"https:\/\/itsupportwale.com\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/itsupportwale.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/itsupportwale.com\/blog\/#organization\",\"name\":\"itsupportwale\",\"url\":\"https:\/\/itsupportwale.com\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/itsupportwale.com\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/itsupportwale.com\/blog\/wp-content\/uploads\/2023\/09\/cropped-Logo-trans-without-slogan.png\",\"contentUrl\":\"https:\/\/itsupportwale.com\/blog\/wp-content\/uploads\/2023\/09\/cropped-Logo-trans-without-slogan.png\",\"width\":1119,\"height\":144,\"caption\":\"itsupportwale\"},\"image\":{\"@id\":\"https:\/\/itsupportwale.com\/blog\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/Itsupportwale-298547177495978\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/itsupportwale.com\/blog\/#\/schema\/person\/8c5a2b3d36396e0a8fd91ec8242fd46d\",\"name\":\"Techie\",\"sameAs\":[\"https:\/\/itsupportwale.com\",\"iswblogadmin\"],\"url\":\"https:\/\/itsupportwale.com\/blog\/author\/iswblogadmin\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How To Install PHP in Ubuntu 18.04 LTS - ITSupportWale","description":"In this article, we learn how to install PHP in Ubuntu 18.04 LTS. You can install the latest PHP 7.4 or the older versions 7.3 or 7.2 by this method.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/itsupportwale.com\/blog\/install-php-in-ubuntu-18-04\/","og_locale":"en_US","og_type":"article","og_title":"How To Install PHP in Ubuntu 18.04 LTS - ITSupportWale","og_description":"In this article, we learn how to install PHP in Ubuntu 18.04 LTS. You can install the latest PHP 7.4 or the older versions 7.3 or 7.2 by this method.","og_url":"https:\/\/itsupportwale.com\/blog\/install-php-in-ubuntu-18-04\/","og_site_name":"ITSupportWale","article_publisher":"https:\/\/www.facebook.com\/Itsupportwale-298547177495978","article_published_time":"2021-01-05T09:58:38+00:00","article_modified_time":"2025-07-08T13:24:22+00:00","og_image":[{"width":800,"height":532,"url":"https:\/\/itsupportwale.com\/blog\/wp-content\/uploads\/2019\/12\/install-php-7.4-ubuntu-server-1.jpg","type":"image\/jpeg"}],"author":"Techie","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Techie","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/itsupportwale.com\/blog\/install-php-in-ubuntu-18-04\/#article","isPartOf":{"@id":"https:\/\/itsupportwale.com\/blog\/install-php-in-ubuntu-18-04\/"},"author":{"name":"Techie","@id":"https:\/\/itsupportwale.com\/blog\/#\/schema\/person\/8c5a2b3d36396e0a8fd91ec8242fd46d"},"headline":"How To Install PHP in Ubuntu 18.04 LTS","datePublished":"2021-01-05T09:58:38+00:00","dateModified":"2025-07-08T13:24:22+00:00","mainEntityOfPage":{"@id":"https:\/\/itsupportwale.com\/blog\/install-php-in-ubuntu-18-04\/"},"wordCount":703,"commentCount":2,"publisher":{"@id":"https:\/\/itsupportwale.com\/blog\/#organization"},"image":{"@id":"https:\/\/itsupportwale.com\/blog\/install-php-in-ubuntu-18-04\/#primaryimage"},"thumbnailUrl":"https:\/\/itsupportwale.com\/blog\/wp-content\/uploads\/2019\/12\/install-php-7.4-ubuntu-server-1.jpg","keywords":["latest php","php 7.4","ubuntu","ubuntu 16.04","ubuntu 18.04"],"articleSection":["FOSS","Linux","php","Tutorial","Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/itsupportwale.com\/blog\/install-php-in-ubuntu-18-04\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/itsupportwale.com\/blog\/install-php-in-ubuntu-18-04\/","url":"https:\/\/itsupportwale.com\/blog\/install-php-in-ubuntu-18-04\/","name":"How To Install PHP in Ubuntu 18.04 LTS - ITSupportWale","isPartOf":{"@id":"https:\/\/itsupportwale.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/itsupportwale.com\/blog\/install-php-in-ubuntu-18-04\/#primaryimage"},"image":{"@id":"https:\/\/itsupportwale.com\/blog\/install-php-in-ubuntu-18-04\/#primaryimage"},"thumbnailUrl":"https:\/\/itsupportwale.com\/blog\/wp-content\/uploads\/2019\/12\/install-php-7.4-ubuntu-server-1.jpg","datePublished":"2021-01-05T09:58:38+00:00","dateModified":"2025-07-08T13:24:22+00:00","description":"In this article, we learn how to install PHP in Ubuntu 18.04 LTS. You can install the latest PHP 7.4 or the older versions 7.3 or 7.2 by this method.","breadcrumb":{"@id":"https:\/\/itsupportwale.com\/blog\/install-php-in-ubuntu-18-04\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/itsupportwale.com\/blog\/install-php-in-ubuntu-18-04\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/itsupportwale.com\/blog\/install-php-in-ubuntu-18-04\/#primaryimage","url":"https:\/\/itsupportwale.com\/blog\/wp-content\/uploads\/2019\/12\/install-php-7.4-ubuntu-server-1.jpg","contentUrl":"https:\/\/itsupportwale.com\/blog\/wp-content\/uploads\/2019\/12\/install-php-7.4-ubuntu-server-1.jpg","width":800,"height":532,"caption":"install-php-7.4-ubuntu-server"},{"@type":"BreadcrumbList","@id":"https:\/\/itsupportwale.com\/blog\/install-php-in-ubuntu-18-04\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/itsupportwale.com\/blog\/"},{"@type":"ListItem","position":2,"name":"How To Install PHP in Ubuntu 18.04 LTS"}]},{"@type":"WebSite","@id":"https:\/\/itsupportwale.com\/blog\/#website","url":"https:\/\/itsupportwale.com\/blog\/","name":"ITSupportWale","description":"Tips, Tricks, Fixed-Errors, Tutorials &amp; Guides","publisher":{"@id":"https:\/\/itsupportwale.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/itsupportwale.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/itsupportwale.com\/blog\/#organization","name":"itsupportwale","url":"https:\/\/itsupportwale.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/itsupportwale.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/itsupportwale.com\/blog\/wp-content\/uploads\/2023\/09\/cropped-Logo-trans-without-slogan.png","contentUrl":"https:\/\/itsupportwale.com\/blog\/wp-content\/uploads\/2023\/09\/cropped-Logo-trans-without-slogan.png","width":1119,"height":144,"caption":"itsupportwale"},"image":{"@id":"https:\/\/itsupportwale.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/Itsupportwale-298547177495978"]},{"@type":"Person","@id":"https:\/\/itsupportwale.com\/blog\/#\/schema\/person\/8c5a2b3d36396e0a8fd91ec8242fd46d","name":"Techie","sameAs":["https:\/\/itsupportwale.com","iswblogadmin"],"url":"https:\/\/itsupportwale.com\/blog\/author\/iswblogadmin\/"}]}},"_links":{"self":[{"href":"https:\/\/itsupportwale.com\/blog\/wp-json\/wp\/v2\/posts\/236","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/itsupportwale.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/itsupportwale.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/itsupportwale.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/itsupportwale.com\/blog\/wp-json\/wp\/v2\/comments?post=236"}],"version-history":[{"count":0,"href":"https:\/\/itsupportwale.com\/blog\/wp-json\/wp\/v2\/posts\/236\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/itsupportwale.com\/blog\/wp-json\/wp\/v2\/media\/3460"}],"wp:attachment":[{"href":"https:\/\/itsupportwale.com\/blog\/wp-json\/wp\/v2\/media?parent=236"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/itsupportwale.com\/blog\/wp-json\/wp\/v2\/categories?post=236"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/itsupportwale.com\/blog\/wp-json\/wp\/v2\/tags?post=236"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}