{"id":1431,"date":"2019-06-03T11:00:43","date_gmt":"2019-06-03T11:00:43","guid":{"rendered":"https:\/\/dev.outrightcrm.in\/dev\/store\/?p=1431"},"modified":"2025-01-01T07:30:55","modified_gmt":"2025-01-01T07:30:55","slug":"how-to-upgrade-php-7-2-and-use-multiple-php-rendition-on-ubuntu-18-04","status":"publish","type":"post","link":"https:\/\/dev.outrightcrm.in\/dev\/store\/blog\/how-to-upgrade-php-7-2-and-use-multiple-php-rendition-on-ubuntu-18-04\/","title":{"rendered":"How to Upgrade PHP to php7.2 and use Multiple PHP Rendition on Ubuntu 18.04"},"content":{"rendered":"\n<p>This tutorial will guide you to upgrade PHP to 7.2 from any past versions like 5.6 or 7.0.<\/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 upgrade PHP to the latest ie 7.2. 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) <\/strong>Become Sudo user with the command <strong>\u201csudo su\u201d<\/strong> and then<\/p>\n\n\n\n<Pre class=\"is-layout-flow wp-block-quote-is-layout-flow\"><blockquote class=\"wp-block-quote\"><p>\u00a0\u00a0\u00a0 apt-get update \u00a0\u00a0\u00a0<\/p><p>\u00a0\u00a0\u00a0 apt-get upgrade<\/p><\/blockquote><\/pre>\n\n\n\n<p><strong>2)<\/strong> Now time to include <strong>\u201cOndrej PPA\u201d<\/strong><\/p>\n\n\n\n<pre><blockquote class=\"wp-block-quote\"><p>&nbsp;&nbsp;&nbsp; sudo apt-get install software-properties-common<\/p><p>&nbsp;&nbsp;&nbsp; sudo add-apt-repository ppa:ondrej\/php<\/p><p>&nbsp;&nbsp;&nbsp; apt-get update<\/p><\/blockquote><\/pre>\n\n\n\n<p><strong>3)<\/strong> Now install PHP and it\u2019s Extensions.<\/p>\n\n\n\n<pre><blockquote class=\"wp-block-quote\"><p>&nbsp;&nbsp;&nbsp; apt-get install php7.2<\/p><p>&nbsp;&nbsp;&nbsp; apt-get install libapache2-mod-php7.2<\/p><p>&nbsp;&nbsp;&nbsp; sudo apt-get install php7.2 php7.2-cli php7.2-common<\/p><p>&nbsp;&nbsp;&nbsp; sudo apt-get install php7.2-json php7.2-opcache<\/p><p>&nbsp;&nbsp;&nbsp; sudo apt-get install php7.2-mysql<\/p><p>&nbsp;&nbsp;&nbsp; sudo apt-get install php7.2-bcmath php7.2-xml<\/p><p>&nbsp;&nbsp;&nbsp; sudo apt-get install php7.2-curl php7.2-imap php7.2-gd<\/p><\/blockquote><\/pre>\n\n\n\n<p><strong>&nbsp;4)<\/strong> Now time to modify <strong>php.ini<\/strong> to add server execution<\/p>\n\n\n\n<pre><blockquote class=\"wp-block-quote\"><p>&nbsp;&nbsp;&nbsp;&nbsp; cd \/etc\/php\/7.2\/apache2<\/p><p>&nbsp;&nbsp;&nbsp;&nbsp; nano php.ini<\/p><p>&nbsp;&nbsp;&nbsp; memory_limit ( 40 - 50 % of Memory),<\/p><p>&nbsp;&nbsp;&nbsp; max_file_uploads (20 - 50),<\/p><p>&nbsp;&nbsp;&nbsp; post_max_size (40 - 50 % of Memory),<\/p><p>&nbsp;&nbsp;&nbsp; max_execution_time (3600) ,<\/p><p>&nbsp;&nbsp; upload_max_filesize ( 40 - 50 % of Memory),<\/p><p>&nbsp;&nbsp;&nbsp; max_input_time = 1000<\/p><\/blockquote><\/pre>\n\n\n\n<p><strong>5)<\/strong> Now disable old PHP and enable a new PHP version<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp; a2dismod php5.6 &nbsp;or a2dismod php7.0<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp; a2enmod php7.2<\/p>\n\n\n\n<p><strong>6)<\/strong> Time to restart Apache<\/p>\n\n\n\n<pre><blockquote class=\"wp-block-quote\"><p>&nbsp;&nbsp;&nbsp; Service apache2 restart<\/p><\/blockquote><\/pre>\n\n\n\n<p><strong>7) <\/strong>Now type<strong> 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>PHP 7.2.5-1+ubuntu18.04.1+deb.sury.org+1 (cli) (built: May &nbsp;3 2019 10:00:24) ( NTS )<\/p>\n\n\n\n<p>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+ubuntu18.04.1+deb.sury.org+1, Copyright (c) 1999- 2018, &nbsp;by Zend Technologies<\/p>\n\n\n\n<p>As you already have seen, you have PHP 7.2, go to the webroot of server ie \/var\/www\/html, Create a file info.php.<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Put this content &nbsp;into this file<\/p>\n\n\n\n<p>Now reach to this file via browser-ie https:\/\/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.2 in our case.<\/p>\n\n\n\n<p>Now if you want to use different PHP for different websites, Go 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>&#8220;To 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.&#8221;<\/em><\/strong><\/p>\n<\/blockquote>\n\n\n\n<p>Anyone Update PHP 7.3 then Click this url : <a href=\"https:\/\/www.php.net\/eol.php\" target=\"_blank\" rel=\"noopener\">https:\/\/www.php.net\/eol.php<\/a> <\/p>\n","protected":false},"excerpt":{"rendered":"<p>This tutorial will guide you to upgrade PHP to 7.2 from any past versions like 5.6 or 7.0.<br \/>\nSo you know you already understand the time for 5.6 and 7.0 passed out months ago.<br \/>\nSo let us plan to upgrade PHP to the latest ie 7.2. Which comes with several safety stains. As a mighty upgrade strategy, Always Backup 100% first.<\/p>\n","protected":false},"author":1,"featured_media":29492,"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":[50],"tags":[66,64,65],"class_list":["post-1431","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-ubuntu","tag-php7-2","tag-upgrade-php","tag-upgrade-php-to-php7-2"],"acf":[],"_links":{"self":[{"href":"https:\/\/dev.outrightcrm.in\/dev\/store\/wp-json\/wp\/v2\/posts\/1431","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=1431"}],"version-history":[{"count":1,"href":"https:\/\/dev.outrightcrm.in\/dev\/store\/wp-json\/wp\/v2\/posts\/1431\/revisions"}],"predecessor-version":[{"id":59408,"href":"https:\/\/dev.outrightcrm.in\/dev\/store\/wp-json\/wp\/v2\/posts\/1431\/revisions\/59408"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/dev.outrightcrm.in\/dev\/store\/wp-json\/wp\/v2\/media\/29492"}],"wp:attachment":[{"href":"https:\/\/dev.outrightcrm.in\/dev\/store\/wp-json\/wp\/v2\/media?parent=1431"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dev.outrightcrm.in\/dev\/store\/wp-json\/wp\/v2\/categories?post=1431"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dev.outrightcrm.in\/dev\/store\/wp-json\/wp\/v2\/tags?post=1431"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}