Ubuntu16.04下PHP7.3测试服务器安装Imagick依赖问题求助
在Ubuntu 16.04为PHP7.3安装Imagick组件的依赖问题解决
问题场景
在Ubuntu 16.04系统的PHP7.3测试服务器上安装Imagick组件时,执行sudo apt-get install php-imagick触发依赖错误:
正在读取软件包列表... 完成
正在构建依赖关系树
正在读取状态信息... 完成
某些软件包无法安装。这可能意味着您请求了不可能的情况或者如果您使用的是不稳定发行版的话,某些已要求的软件包尚未被创建或移出Incoming。
下列信息可能会有助于解决问题:下列软件包有未满足的依赖关系:
php-imagick : 依赖: php-common (>= 1:7.0+33~) 但它将不会被安装
依赖: phpapi-20151012
E: 无法修正错误,因为您要求某些软件包保持现状,就是它们破坏了软件包间的依赖关系。
用户已尝试的操作:
LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/php apt update apt install php7.3 php7.3-cli php7.3-common sudo apt-get install php-imagick sudo apt-get update sudo apt-get install -y php-imagick sudo apt-get install php-common php7.3-common sudo apt-get install php-imagick sudo apt-get install php-common=1:7.3+33~ php7.3-common sudo apt-get install php-common php7.3-common sudo apt-get install php-imagick sudo apt-get --fix-broken install sudo apt-get install php-imagick sudo dpkg -i php-imagick_3.4.0-4_amd64.deb # Replace with the correct filename if using 32-bit sudo dpkg -i php-imagick_3.4.0-4_i386.deb wget http://archive.ubuntu.com/ubuntu/pool/universe/p/php-imagick/php-imagick_3.4.0-4_i386.deb sudo apt-get install imagemagick libmagickwand-dev sudo apt install php php-common gcc sudo apt install imagemagick sudo apt install php-imagick sudo apt-get install php-imagick sudo apt install php-imagick sudo apt install php7.3-imagick history
解决步骤
重新确认源配置并更新
确保ondrej/php源正常生效,执行:LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/php sudo apt-get update若出现GPG密钥错误,需先导入对应密钥。
安装PHP7.3专属的Imagick包
避免使用通用php-imagick包,直接指定PHP版本安装:sudo apt-get install php7.3-imagick该包会自动匹配PHP7.3的依赖版本,解决版本不兼容问题。
清理残留依赖并修复
若之前操作导致依赖混乱,先清理后修复:sudo apt-get autoremove sudo apt-get clean sudo apt-get --fix-broken install完成后再次执行
php7.3-imagick的安装命令。验证安装结果
安装完成后,执行以下命令确认组件加载:php7.3 -m | grep imagick输出
imagick即为安装成功。
内容的提问来源于stack exchange,提问作者Aashir Zia
相关产品推荐
相关产品推荐

