How to Upgrade php Version

How to Upgrade php Version

  • 20 Sep, 2020
  • Technology

How to Upgrade php from (7.1 to 7.2) Ubuntu

1. If not, login using root, then use command sudo -s
Check Current php version
php -v
2. sudo add-apt-repository ppa:ondrej/php
3. sudo apt-get update
4. sudo apt-get install php7.2
5. sudo apt-get install php7.2-cli php7.2-common php7.2-json php7.2-opcache php7.2-mysql php7.2-mbstring php7.2- mcrypt php7.2-zip php7.2-fpm php7.2-intl php7.2-simplexml

6. sudo a2dismod php7.1
7. sudo a2enmod php7.2
8. sudo service apache2 restart
9. sudo update-alternatives --set php /usr/bin/php7.2
10. sudo update-alternatives --set phar /usr/bin/phar7.2
11. sudo update-alternatives --set phar.phar /usr/bin/phar.phar7.2
12. sudo update-alternatives --set phpize /usr/bin/phpize7.2
13. sudo update-alternatives --set php-config /usr/bin/php-config7.2
14. Check current Version of PHP by using command
php -v