I want to upgrade my apache php version on ubuntu 16.04. Right now phpinfo()
shows 7.0.26. How can I upgrade?
I want to upgrade to phpversion 7.2. sudo apt install php7.2
, doesn't update the apache php version. How can I update the apache php version.
I'm assuming that you already have apache and php 7.0 installed, and that you're using the Ondřej Surý PPA something like this:
LC_ALL=C.UTF-8 sudo add-apt-repository ppa:ondrej/php
sudo apt update
sudo apt install php7.2
At this point, you would need to remove the old libapache2-mod-php package, install the new one, and restart apache:
sudo apt remove libapache2-mod-php*
sudo apt update
sudo apt install libapache2-mod-php7.2
sudo service apache2 restart
Now, phpinfo()
from within a web page should show PHP Version 7.2.0-2+ubuntu16.04.1+deb.sury.org+2
If the add-apt-repository
command is missing, you can install it with:
sudo apt install software-properties-common
Please run below commands to upgrade your PHP version to 7.2
sudo apt-get update
sudo apt-get install python-software-properties
sudo LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/php
sudo apt-get install php7.2
sudo a2dismod php7.0
sudo a2enmod php7.2
sudo update-alternatives --set php /usr/bin/php7.2
sudo service apache2 restart
sudo apt-get install libapache2-mod-php7.2 php7.2-cgi php7.2-cli php7.2-common php7.2-curl php7.2-gd php7.2-imap php7.2-intl php7.2-json php7.2-ldap php7.2-mbstring php7.2-mysql php7.2-opcache php7.2-pspell php7.2-readline php7.2-soap php7.2-xml
sudo a2enmod proxy_fcgi setenvif
sudo a2enconf php7.2-fpm
sudo service apache2 restart
Hope this helps !!!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With