0
votes

I have multiple PHP version installed (7.0, 7.1 and 7.3). I have enabled PHP 7.0 (I need to keep this version for various reasons). When I try to install imagick (via sudo apt-get install php-imagick) the libraries are copied/installed only for PHP 7.3, despite I'm using 7.0 as confirmed by php -v and phpinfo file.

Am I missing any Apache setting? Why it doesn't consider the current 7.0 enabled module as default php version while installing new php libraries?

OS: Debian 10 WS: Apache/2.4.38

I've tried to edit php.ini, enable extensions, usual basic procedure... but imagick.so is compiled for php 7.3 only. There's no trace of them in the extension folder of PHP 7.0 and it's not possible to load it.

UPDATE #1

Checking with sudo update-alternatives --config php
I see this table (see image) - I don't know how to change priority or automode. It looks like PHP 7.3 keep the top priority.


screen

UPDATE #2

Tried this, no results.

PHP 7.0 set as default
sudo update-alternatives --set php /usr/bin/php7.0 sudo update-alternatives --set php-config /usr/bin/php-config7.0 sudo update-alternatives --set phpize /usr/bin/phpize7.0

Reinstall imagick

sudo apt-get install imagemagick php-imagick --reinstall
(no error, but it keeps installing them for PHP 7.3)
php -m show no modules, because they are in the extension folder of php 7.3

1
How did you install each version of PHP? - Jonnix
Usually apt favors installing the latest version available, I don't think it takes into account alternatives. If you are using external repos, they could have higher priority. Try installing php7.0-imagick - msg
@Jonnix via ppa repo. - MineralProbe
All of them? Then they are probably versioned appropriately in the repos. apt search php imagick and find the appropriate package to install for each version. - Jonnix
@Jonnix Yes, all of them. I've updated my question. - MineralProbe

1 Answers

0
votes

Debian 10 uses PHP 7.3 as its "standard" PHP version, so all of its PHP extension packages -- including php-imagick -- will contain extensions which target PHP 7.3.

If you have somehow installed PHP 7.0 (which you should not do, as it reached end-of-life in January 2019 and no longer receives security updates), you will need to obtain extensions for it through some other channel.