francisaugusto
francisaugusto

Reputation: 1187

phpenmod showing path from other php version

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.

Upvotes: 6

Views: 5313

Answers (1)

apokryfos
apokryfos

Reputation: 40653

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.

Upvotes: 8

Related Questions