{"id":40075,"date":"2021-05-27T09:57:46","date_gmt":"2021-05-27T09:57:46","guid":{"rendered":"https:\/\/dev.outrightcrm.in\/dev\/store\/?p=40075"},"modified":"2025-07-28T12:44:54","modified_gmt":"2025-07-28T12:44:54","slug":"how-to-upgrade-php-to-php7-4-and-use-multiple-php-rendition-on-ubuntu-20-04","status":"publish","type":"post","link":"https:\/\/dev.outrightcrm.in\/dev\/store\/blog\/how-to-upgrade-php-to-php7-4-and-use-multiple-php-rendition-on-ubuntu-20-04\/","title":{"rendered":"How to Update PHP 7.2 to PHP 7.4 and Use Multiple PHP Rendition on Ubuntu 20.04"},"content":{"rendered":"\n<p>This tutorial will guide you on how to upgrade PHP 7.2 or any other older version to PHP 7.4.<\/p>\n\n\n\n<p>So you know you already understand the time for 5.6 and 7.0 passed out months ago.<\/p>\n\n\n\n<p>So let us plan to <a href=\"https:\/\/www.outrightsystems.org\/blog\/update-php-to-7-3-and-use-multiple-php-on-same-server-on-ubuntu-18-04\/\" target=\"_blank\" rel=\"noreferrer noopener\">upgrade PHP<\/a> to the latest ie 7.4. Which comes with several safety stains. As a mighty upgrade strategy, Always Backup 100% first. So keep everything backup accompanied by databases.<\/p>\n\n\n\n<div style=\"height:20px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p>At Ubuntu, with my particular experience, before starting any advance, always start with 2 commands.<\/p>\n\n\n\n<p><strong>1)&nbsp;<\/strong>Become Sudo user with the command&nbsp;<strong>\u201csudo su\u201d<\/strong>&nbsp;and then<\/p>\n\n\n\n<div style=\"height:20px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<pre class=\"wp-block-code\"><code>apt-get update\napt-get upgrade<\/code><\/pre>\n\n\n\n<div style=\"height:20px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p><strong>2)<\/strong>&nbsp;Now time to include&nbsp;<strong>\u201cOndrej PPA\u201d<\/strong><\/p>\n\n\n\n<div style=\"height:20px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt-get install software-properties-common\nsudo add-apt-repository ppa:ondrej\/php\napt-get update<\/code><\/pre>\n\n\n\n<div style=\"height:20px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p><strong>3)<\/strong>&nbsp;Now install PHP and its Extensions.<\/p>\n\n\n\n<div style=\"height:20px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<pre class=\"wp-block-code\"><code>apt-get install php7.4\napt-get install libapache2-mod-php7.4\nsudo apt-get install php7.4 php7.4-cli php7.4-common\nsudo apt-get install php7.4-json php7.4-opcache\nsudo apt-get install php7.4-mysql\nsudo apt-get install php7.4-bcmath php7.4-xml\nsudo apt-get install php7.4-curl php7.4-imap php7.4-gd<\/code><\/pre>\n\n\n\n<div style=\"height:20px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p><strong>&nbsp;4)<\/strong>&nbsp;Now time to modify&nbsp;<strong>php.ini<\/strong>&nbsp;to add server execution<\/p>\n\n\n\n<div style=\"height:20px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<pre class=\"wp-block-code\"><code>cd \/etc\/php\/7.4\/apache2\nnano php.ini\nmemory_limit ( 40 - 50 % of Memory),\nmax_file_uploads (20 - 50),\npost_max_size (40 - 50 % of Memory),\nmax_execution_time (3600) ,\nupload_max_filesize ( 40 - 50 % of Memory),\nmax_input_time = 1000<\/code><\/pre>\n\n\n\n<div style=\"height:20px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p><strong>5)<\/strong>&nbsp;Now disable old PHP and enable a new PHP version<\/p>\n\n\n\n<div style=\"height:20px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<pre class=\"wp-block-code\"><code>a2dismod php5.6  or a2dismod php7.0\na2enmod php7.4<\/code><\/pre>\n\n\n\n<div style=\"height:20px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p><strong>6)<\/strong>&nbsp;Time to restart Apache<\/p>\n\n\n\n<div style=\"height:20px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<pre class=\"wp-block-code\"><code>Service apache2 restart<\/code><\/pre>\n\n\n\n<div style=\"height:20px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p><strong>7)&nbsp;<\/strong>Now type<strong>&nbsp;php -v or php \u2013version<\/strong><\/p>\n\n\n\n<p>&nbsp;&nbsp;You should get a message like this<\/p>\n\n\n\n<p><em>PHP 7.4.5-1+ubuntu20.04.1+deb.sury.org+1 (cli) (built: May &nbsp;3 2019 10:00:24) ( NTS )<\/em><\/p>\n\n\n\n<p><em>Copyright (c) 1997-2018 The PHP Group Zend Engine v3.3.5, Copyright (c) 1998-2018 Zend Technologies with Zend OPcache v7.2.5-1+ubuntu20.04.1+deb.sury.org+1, Copyright (c) 1999- 2018, &nbsp;by Zend Technologies<\/em><\/p>\n\n\n\n<p>As you already have seen, you have PHP 7.4, go to the webroot of the server i.e. <mark style=\"background-color:#abb8c3\" class=\"has-inline-color has-black-color\">\/var\/www\/html<\/mark>, and Create a file <mark style=\"background-color:#abb8c3\" class=\"has-inline-color\">info.php<\/mark>.<\/p>\n\n\n\n<p>Put this content into this file<\/p>\n\n\n\n<p>Now reach this file via browser-ie\u00a0https:\/\/mydomain\/info.php<\/p>\n\n\n\n<p>So your command line PHP (PHP-CLI) and PHP on the browser must be the same version. ie php7.4 in our case.<\/p>\n\n\n\n<p>Now if you want to use different PHP for different websites, Go to this article.<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p><strong><em>\u201cTo be summarised, Keeping sustained upgrades of software and servers, pushing you ahead in the set-to, as new upgrades come with protection upgrades and patches. Also, It has seen considerable speed improvements after upgrades.\u201d<\/em><\/strong><\/p>\n<\/blockquote>\n\n\n\n<p>Anyone Update PHP 7.4 then Click this URL:&nbsp;https:\/\/www.php.net\/eol.php<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This tutorial will guide you on how to upgrade PHP 7.2 or any other older version to PHP 7.4. So [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":40085,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[62],"tags":[],"class_list":["post-40075","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-technology"],"acf":[],"_links":{"self":[{"href":"https:\/\/dev.outrightcrm.in\/dev\/store\/wp-json\/wp\/v2\/posts\/40075","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dev.outrightcrm.in\/dev\/store\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dev.outrightcrm.in\/dev\/store\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dev.outrightcrm.in\/dev\/store\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/dev.outrightcrm.in\/dev\/store\/wp-json\/wp\/v2\/comments?post=40075"}],"version-history":[{"count":2,"href":"https:\/\/dev.outrightcrm.in\/dev\/store\/wp-json\/wp\/v2\/posts\/40075\/revisions"}],"predecessor-version":[{"id":59409,"href":"https:\/\/dev.outrightcrm.in\/dev\/store\/wp-json\/wp\/v2\/posts\/40075\/revisions\/59409"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/dev.outrightcrm.in\/dev\/store\/wp-json\/wp\/v2\/media\/40085"}],"wp:attachment":[{"href":"https:\/\/dev.outrightcrm.in\/dev\/store\/wp-json\/wp\/v2\/media?parent=40075"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dev.outrightcrm.in\/dev\/store\/wp-json\/wp\/v2\/categories?post=40075"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dev.outrightcrm.in\/dev\/store\/wp-json\/wp\/v2\/tags?post=40075"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}