Harnessing the Power of SEO Optimization Zanzibar | A Guide to Boosting Your Digital Presence
Zanzibar is home to beautiful beaches, politics, history, culture, and beautiful people, and has attracted many tourists and various business…
Read MoreTable of Contents
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.
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 7.3.5-1+ubuntu18.04.1+deb.sury.org+1 (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 v7.3.5-1+ubuntu18.04.1+deb.sury.org+1, 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.