duanbarong4321
2019-07-30 21:24
浏览 340
已采纳

如何在当前启用的PHP版本中安装imagick?

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

图片转代码服务由CSDN问答提供 功能建议

我安装了多个PHP版本(7.0,7.1和7.3)。 我启用了PHP 7.0(由于各种原因我需要保留此版本)。 当我尝试安装imagick时(通过sudo apt-get install php-imagick),只为PHP 7.3复制/安装库,尽管我使用的是php -v和phpinfo文件确认的。

我错过了任何Apache设置吗? 为什么在安装新的php库时它不会将当前7.0启用的模块视为默认的php版本?

操作系统:Debian 10 WS:Apache / 2.4.38

我试过编辑php.ini,启用扩展,通常的基本程序 ...但是imagick.so仅针对php 7.3编译。 在PHP 7.0的扩展文件夹中没有它们的痕迹,也无法加载它。

更新#1

检查 sudo update-alternatives --config php
我看到此表(见图) - 我不知道如何更改优先级或自动模式 。 看起来PHP 7.3保持最高优先级。


屏幕

更新#2

试过这个,没有结果。

PHP 7.0默认设置
sudo update-alternatives - 设置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

重新安装imagick

sudo apt-get install imagemagick php-imagick --reinstall
(没有错误 ,但它继续为PHP 7.3安装它们。
php -m show no modules,因为它们位于php 7.3的扩展文件夹中 \ n

  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • duanmei1694 2019-07-30 21:59
    已采纳

    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.

    已采纳该答案
    打赏 评论

相关推荐 更多相似问题