6

I have php 7.0 and 7.2 installed on my Ubuntu machine.

When I execute php -v, it tells me I am using php 7.2. On Apache I have also enabled php 7.2.

When I run phpenmode zip, I get this:

WARNING: Module zip ini file doesn't exist under /etc/php/7.0/mods-available

Though the file is indeed under /etc/php/7.2/mods-available.

How can I fix this? I tip that this is what is causing some applications complaining that the ZipArchive class is not installed.

francisaugusto
  • 1,077
  • 1
  • 12
  • 29

1 Answers1

8

If you have mutliple php versions installed you can do:

phpenmod -v 7.2 zip

to target the 7.2 version.

To modify the default target version you can try:

sudo update-alternatives --set php /usr/bin/php7.2 
sudo update-alternatives --set phar /usr/bin/phar7.2
sudo update-alternatives --set phar.phar /usr/bin/phar.phar7.2 
sudo update-alternatives --set phpize /usr/bin/phpize7.2 
sudo update-alternatives --set php-config /usr/bin/php-config7.2

Note: phpize might not always be present as it needs the php-dev package

This will also change the version that is used in the CLI and therefore get rid of an additional headache of trying to figure out why things work in FPM but not on CLI.

apokryfos
  • 38,771
  • 9
  • 70
  • 114
  • It didn't work on my first attempt, but using these commands worked: `sudo update-alternatives --set php /usr/bin/php7.2 sudo update-alternatives --set phar /usr/bin/phar7.2 sudo update-alternatives --set phar.phar /usr/bin/phar.phar7.2 sudo update-alternatives --set phpize /usr/bin/phpize7.2 sudo update-alternatives --set php-config /usr/bin/php-config7.2` – francisaugusto May 14 '19 at 17:13