Published by  Ashish Dwivedi  on

Update PHP to 7.3 and use Multiple PHP on Same Server on Ubuntu 18.04

How to Upgrade PHP to php7.3 and use Multiple PHP Version on Ubuntu 18.04

Recently you started gettings warning to upgrade PHP, you are still at 5.6, you may look at end of life timelines.

So you now you already know the time for 5.6 and 7.0 passed out months ago.

So let us plan to upgrade PHP to latest ie 7.3. Which comes with several security patches. As a great upgrade strategy, Always Backup 100% first. So keep everything backup including databases.

Update PHP to 7.3 and use Multiple PHP on Same Server on Ubuntu 18.04

At Ubuntu , with my personal experience, beforing starting any upgrade, always start with 2 commands.

1) Become Sudo user with command “sudo su” and than

     apt-get update    
     apt-get upgrade  

 2) Now time to include Ondrej PPA

     sudo apt-get install software-properties-common
     sudo add-apt-repository ppa:ondrej/php
     apt-get update

 3) Now install PHP and it’s Extensions.

     apt-get install php7.3
     apt-get install libapache2-mod-php7.3
     sudo apt-get install php7.3 php7.3-cli php7.3-common
     sudo apt-get install php7.3-json php7.3-opcache 
     sudo apt-get install php7.3-mysql
     sudo apt-get install php7.3-bcmath php7.3-xml
     sudo apt-get install php7.3-curl php7.3-imap php7.3-gd

  4) Now time to modify php.ini to enhance server performance

     cd /etc/php/7.3/apache2
     nano php.ini
     memory_limit ( 40 - 50 % of Memory), 
     max_file_uploads (20 - 50), 
     post_max_size (40 - 50 % of Memory), 
     max_execution_time (3600) , 
     upload_max_filesize ( 40 - 50 % of Memory), 
     max_input_time = 1000

5) Now disable old php and enable new php version

     a2dismod php5.6  or a2dismod php7.0

     a2enmod php7.3

6) Time to restart Apache

     Service apache2 restart

7) Now type php -v or php –version

   You should get a message like this

 PHP (cli) (built: May  3 2019 10:00:24) ( NTS )

Copyright (c) 1997-2018 The PHP Group

Zend Engine v3.3.5, Copyright (c) 1998-2018 Zend Technologies

with Zend OPcache, Copyright (c) 1999- 2018,  by Zend Technologies

   As you already have seen, you have php 7.3 , go to the webroot of server ie /var/www/html , Create a file info.php.

       Put this content  into this file




Now reach to this file via browser ie https://mydomain/info.php

So your command line PHP (PHP-CLI) and PHP on browser must be the same version. ie php7.3 in our case.

Now if you want to use different PHP for different websites, Go this article..

To be summarised, Keeping continuous upgrades of software and servers , pushing you ahead in the competition, as new upgrades come with security upgrades and patches. Also It has seen significant speed improvements after upgrades.



cialis online · November 7, 2019 at 8:34 pm

Great goods from you, man. I’ve understand your stuff previous to and you’re just extremely excellent.
I really like what you’ve acquired here, really like what you are saying and
the way in which you say it. You make it enjoyable and you still take care of to keep it sensible.
I can not wait to read much more from you. This is really a wonderful site.

cialis buy online · November 19, 2019 at 10:17 pm

I’ve been exploring for a bit for any high-quality articles or
blog posts in this sort of house . Exploring in Yahoo I finally stumbled upon this web site.

Reading this info So i am happy to exhibit that I’ve an incredibly good
uncanny feeling I came upon exactly what I needed. I so much indubitably will make certain to don?t
omit this website and give it a glance on a relentless basis.

generic cialis · December 1, 2019 at 6:45 am

Wonderful blog! I found it while surfing around on Yahoo News.
Do you have any tips on how to get listed in Yahoo News?
I’ve been trying for a while but I never seem to get
there! Appreciate it

Leave a Reply

Your email address will not be published. Required fields are marked *