如何在 Ubuntu 中安装 PHP GD [英] How to install PHP GD in Ubuntu

查看:37
本文介绍了如何在 Ubuntu 中安装 PHP GD的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想用 GD 转换低分辨率的图像.我正在这些规范下的 IBM 服务器上工作版本:PHP 7.0.15-0ubuntu0.16.04.4 (cli) ( NTS )
我也从 php.ini 注释掉了扩展名,但无法在 php 服务器上启用 GD.我刚收到这个错误.

I want to convert the image in low resolution with GD. I'm working on IBM Server under these speces Version: PHP 7.0.15-0ubuntu0.16.04.4 (cli) ( NTS )
and I have also comment out the extension from php.ini but can't enabled the GD on php server. I Just received this error.

运行命令: sudo apt-get install libgd

Run Command: sudo apt-get install libgd

正在阅读包裹清单...完成

Reading package lists... Done

构建依赖树读取状态信息...完成E: 无法定位软件包 libgd

Building dependency tree Reading state information... Done E: Unable to locate package libgd

当我运行时的第二个命令给出此消息:

Second Command When I run give this message:

1) 包有未满足的依赖项

1) packages have unmet dependencies

并在运行此命令后收到:

and after running this command received this:

命令: sudo apt-get install libgd-dev

Command: sudo apt-get install libgd-dev

正在阅读包裹清单...完成

Reading package lists... Done

构建依赖树

正在读取状态信息...完成

Reading state information... Done

您可能需要运行apt-get -f install"来更正这些:

You might want to run 'apt-get -f install' to correct these:

以下软件包具有未满足的依赖项:libgd-dev : 取决于: libgd3 (= 2.1.1-4ubuntu0.16.04.6) 但它不会被安装

The following packages have unmet dependencies: libgd-dev : Depends: libgd3 (= 2.1.1-4ubuntu0.16.04.6) but it is not going to be installed

         Depends: libpng-dev

         Depends: libz-dev

         Depends: libjpeg-dev

         Depends: libfreetype6-dev but it is not going to be installed

         Depends: libxpm-dev but it is not going to be installed

         Depends: libx11-dev but it is not going to be installed

         Depends: libxt-dev but it is not going to be installed

         Depends: libfontconfig-dev

         Depends: libvpx-dev but it is not going to be installed

         Depends: libtiff-dev

linux-image-virtual : 取决于: linux-image-4.4.0-81-generic 但它不会被安装

linux-image-virtual : Depends: linux-image-4.4.0-81-generic but it is not going to be installed

E:未满足的依赖项.尝试不带软件包的apt-get -f install"(或指定解决方案).

E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).

此问题的原因:

PHP 致命错误:未捕获的错误:调用未定义的函数 imagecreatefromstring()

PHP Fatal error: Uncaught Error: Call to undefined function imagecreatefromstring()

请注意,请任何人告诉我在我的这台 Linus 机器上启用此 GD 库的分步命令.非常感谢

Note please anyone tell me the step-by-step command to enable this GD Library on my this Linus machine. thanks alot

推荐答案

sudo apt-get update

对于 5.6 PHP

sudo apt-get install php5.6-gd

对于 7.0 PHP

sudo apt-get install php7.0-gd

对于 8.0 PHP

sudo apt-get install php8.0-gd

这篇关于如何在 Ubuntu 中安装 PHP GD的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆