Ubuntu 14.04 - PHP Version Upgraded from 5.5.9 to 5.6 - phpinfo still shows 5.5.9, php -v shows 5.6 - uninstalling 5.5.9??

September 3, 2016 62.9k views
PHP Apache LAMP Stack Ubuntu

I tried several ways to upgrade PHP on my Ubuntu 14.04 machine from 5.5.9 to 5.6. It was not easy, at least it worked like described on http://devdocs.magento.com/guides/v2.0/install-gde/prereq/php-ubuntu.html.

Typing php -v shows

codePHP 5.6.25-2+deb.sury.org~trusty+1 (cli)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologiescode

looks good so far....

But phpinfo still shows
codePHP Version 5.5.9-1ubuntu4.19code

How can I enforce apache to use PHP 5.6??

6 Answers


Don't know if you guys already resolved the problem, but here is how i did:

sudo a2dismod php5
sudo a2enmod php5.6
sudo service apache2 restart

As described here by michaelpporter


a2dismod and a2enmod didn't work. I found the following solution based on the answer on

sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get purge php5-common # remove and purge old PHP 5.x packages
sudo apt-get update # I had to run the update command again
sudo apt-get install libapache2-mod-php5.6

now phpinfo() shows
PHP Version 5.6.26-1+deb.sury.org~trusty+1

So I would say it works... ;)

  • Note: uninstalling php5 also removed phpmyadmin --> after reinstalling phpmyadmin the system was a little bit confused, both php-versions - php5 and php5.6 were "alive";
    phpmyadmin did not work - module mbstring was missing.

    Solution: disabling module php5 and enabling php5.6 using the command

    sudo a2dismod php5
    sudo a2enmod php5.6
    sudo service apache2 restart

    installing mbstring and other modules using

    sudo apt-get install php5.6-mbstring
    sudo apt-get install php5.6-gettext
    sudo apt-get install php5.6-mysql
    sudo service apache2 restart

    now phpmyadmin is working fine!

    This post was helping me to find the solution:

I have the same problem, any news @flesh ?

No one else got this problem?

No answer... it seems that no one else has this problem...

  • hmm sad. I have made like 5 installs and tried different solutions but still cant come by this...

In my case i needed to work with php 7.0 and the following worked:

sudo a2dismod php5;
sudo a2enmod php7.0;
sudo service apache2 restart;

Hope this helps !

Have another answer? Share your knowledge.