7

I've done the following:

sudo add-apt-repository ppa:ondrej/php5-5.6
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install php5
sudo apt-get install libapache2-mod-php5.6
sudo add-apt-repository ppa:ondrej/apache2

When I try to disable the old version of php5 with:

sudo phpdismod php5

I get the error: WARNING: Module php5 ini file doesn't exist under /etc/php/5.6/mods-available

Even if I move the ini file under this directory it gives me the same error. I don't know what I'm missing??

In general, can someone explain to me how to get my instance to use the newly installed version, as I still seem to have both php directory trees on my instance. php5/.. and php/5.6

6
  • i think your upgrade not complete , you can check this link is how to upgrade devdocs.magento.com/guides/v2.0/install-gde/prereq/… – Mohamed Slama May 23 '16 at 2:06
  • Thank you for the link! I followed but when I run phpinfo() from a test file in my directory it still shows that I'm running version 5.5.9. However, when I do php -v from terminal it says PHP 5.6.21-9+dontate.sury.org~trusty+1, so it seems like 5.6 is installed correctly. Any ideas how to get my application to run the right version? – Scott May 23 '16 at 2:50
  • if terminal write 5.6 it should work with 5.6 – Mohamed Slama May 23 '16 at 2:56
  • restart if not working correctly check if the problem with code – Mohamed Slama May 23 '16 at 3:00
  • It's not running 5.6 for some reason. It's like I need to change something in the apache config file to get the application to use the new version, but I don't know how. – Scott May 23 '16 at 3:11
16

You are mixing different PPAs and versions and commands in incompatible way, let's break it down:

  1. libapache2-mod-php5.6 is present in ppa:ondrej/php and this is really the PPA you want to be using

  2. phpdismod is a command for disabling PHP extensions, and not to manage Apache2 modules, you need a2dismod for that

  3. The PHP Apache2 module in ppa:ondrej/php5-5.6 is named libapache2-mod-php5

So the correct would be:

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 install libapache2-mod-php5.6

If you don't uninstall php5-* packages first, you need to disable the php5 module and enable php5.6 module:

sudo a2dismod php5
sudo a2enmod php5.6

And optionally add Apache2 repository:

sudo add-apt-repository ppa:ondrej/apache2
sudo apt-get update
sudo apt-get dist-upgrade

There's a migrationg guide available for PPA packages.

2
  • Make SURE to also install any additional php modules you were using (mysql), as this one comes only with the bare basics. – Captain Hypertext Dec 15 '16 at 7:35
  • You may also require: sudo apt-get install libapache2-mod-php sudo apt-get install php-curl php-dev php-gd php-json php-mcrypt php-mysql php-readline php-sqlite3 – Amil Waduwawara Mar 25 '17 at 15:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.