如何在 ubuntu 21.04 中下载 php7.2-gd 扩展?

How to download php7.2-gd extension in ubuntu 21.04?

我想在我当前的 php-project(php 版本是 7.2.34)中安装 gd 扩展,因为我使用这个命令 sudo apt-get install php7.2-gd 它抛出以下错误并且它是当我 运行 php -m 命令时没有显示在列表中,如何安装 gd 扩展请帮我解决这个问题..

Error

Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 php7.2-gd : Depends: libjpeg62-turbo (>= 1.3.1) but it is not installable
E: Unable to correct problems, you have held broken packages.

这个包依赖于libjpeg62-turbo所以你需要先安装它

wget http://ftp.debian.org/debian/pool/main/libj/libjpeg-turbo/libjpeg62-turbo_1.5.1-2_amd64.deb
sudo apt-get install ./libjpeg62-turbo_1.5.1-2_amd64.deb

之后,您就可以轻松安装包了

sudo apt-get install php7.2-gd