如何使用 Composer 添加 php gd (laravel 8)
我试图将PHP GD添加到Composer.json。 我想安装PHP GD,因为有以下错误:
The PHP GD extension is required, but is not installed.
错误是由DOMPDF引起的,因为DOMPDF需要PHP GD处理图像。 我尝试了以下命令:
composer require "ext-gd:*" --ignore-platform-reqs
没有任何结果,即使艰难的Ext-GD也添加到了作曲家。 有人知道解决我问题的解决方案吗? 预先感谢。
I trying to add php gd to the composer.json.
I want to install php gd because of the following error :
The PHP GD extension is required, but is not installed.
The error was caused by dompdf as dompdf requires php gd to process images.
I tried the following command :
composer require "ext-gd:*" --ignore-platform-reqs
Without any result even tough ext-gd was added to the composer.json.
Does anyone know a solution to my problem?
Thank in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
更多
发布评论
评论(1)
您无法使用 Composer 安装 GD。 Composer 管理您的项目依赖的其他 PHP 源,但 GD 不是 PHP 源 - 它是一个原生 PHP 扩展模块,如 ext-curl 或 ext-mysqli 。将
ext-gd:*
添加到您的composer.json 只是意味着“该项目需要安装GD 扩展”。为了实际安装该扩展,您需要使用操作系统级工具。如果您使用的是基于 Debian 的系统,则可能类似于:或者,对于基于 RedHat 的系统,类似于:
完成后,再次运行
composer install
,您应该好的。You can't install GD with Composer. Composer manages other PHP source that your project relies on, but GD is not PHP source -- it's a native PHP extension module like
ext-curl
orext-mysqli
. Addingext-gd:*
to your composer.json simply means, "This project requires the GD extension to be installed." In order to actually install that extension, you'll need to drop to your OS-level tools. If you're on a Debian-based system, that'll likely be something like:Or, for a RedHat-based system, something like:
Once done, run your
composer install
again and you should be good.