How to Upgrade PHP 5.x to 7.0

I had an issue upgrading php from version 5.6 to 7.0 for my new wordpress plugin. Even after the installation has been completed and php -v command shows the new version of php, wordpress says that the host is still running with the old version.

*Host OS version: Ubuntu 14.04.5 LTS

After installing php 7.0, disable old php version, enable new version and then restart apache2.

$ sudo apt-add-repository ppa:ondrej/php
$ sudo apt-get update
$ sudo apt-get upgrade
$ sudo apt-get -y install php7.0 php7.0-fpm php7.0-mcrypt php7.0-mbstring php7.0-ssh2 php7.0-curl php7.0-cli php7.0-mysql php7.0-gd php7.0-intl php7.0-xsl php7.0-zip libapache2-mod-php7.0
$ sudo a2dismod php5
$ sudo a2enmod php7.0
$ sudo service apache2 restart


Leave a Reply

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