GD 库扩展不适用于此 PHP 安装 Ubuntu Nginx
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/34009844/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
GD Library extension not available with this PHP installation Ubuntu Nginx
提问by Saeed Vaziry
i am using laravel
web framework on my ubuntu 14.04
server and nginx
web server , i have this error when i try to upload file using laravel
to server.
my upload directory is on public/uploads
folder that has 777 permission.
我laravel
在我的ubuntu 14.04
服务器和nginx
Web 服务器上使用Web 框架,当我尝试使用上传文件laravel
到服务器时出现此错误。我的上传目录位于public/uploads
具有 777 权限的文件夹中。
回答by Limon Monte
The GD Graphics Library is for dynamically manipulating images. For Ubuntu you should install it manually:
GD 图形库用于动态处理图像。对于 Ubuntu,您应该手动安装它:
- PHP5:
sudo apt-get install php5-gd
- PHP7.0:
sudo apt-get install php7.0-gd
- PHP7.1:
sudo apt-get install php7.1-gd
- PHP7.2:
sudo apt-get install php7.2-gd
- PHP7.3:
sudo apt-get install php7.3-gd
- PHP7.4:
sudo apt-get install php7.4-gd
- PHP5:
sudo apt-get install php5-gd
- PHP7.0:
sudo apt-get install php7.0-gd
- PHP7.1:
sudo apt-get install php7.1-gd
- PHP7.2:
sudo apt-get install php7.2-gd
- PHP7.3:
sudo apt-get install php7.3-gd
- PHP7.4:
sudo apt-get install php7.4-gd
That's all, you can verify that GD support loaded:
就是这样,您可以验证是否加载了 GD 支持:
php -i | grep -i gd
Output should be like this:
输出应该是这样的:
GD Support => enabled
GD headers Version => 2.1.1-dev
gd.jpeg_ignore_warning => 0 => 0
回答by user3278087
@limonte's answer is correct, but if you're using PHP7+, you should use following command:
@limonte 的答案是正确的,但如果您使用的是 PHP7+,则应使用以下命令:
sudo apt-get install php7.0-gd
sudo apt-get install php7.0-gd
If you don't know what version of PHP you're using, just type
如果您不知道您使用的是哪个版本的 PHP,只需键入
php -v
php -v
Output should start with something similar to PHP 7.0.8-0ubuntu0.16.04.2 (cli) ( NTS )
.
输出应以类似于PHP 7.0.8-0ubuntu0.16.04.2 (cli) ( NTS )
.
回答by Md. Noor-A-Alam Siddique
for php -v 7.1
对于 php -v 7.1
sudo apt-get install php7.1-gd
works for me
为我工作
回答by Hemamalini
Php 5.6 worked with below command
PHP 5.6 使用以下命令
PHP5.6: sudo apt-get install php5.6-gd
PHP5.6: sudo apt-get install php5.6-gd
after installing restart server
安装重启服务器后
sudo service apache2 restart
回答by JTC
回答by felipe_dmz
I'm experiencing something unsual:
我遇到了一些不寻常的事情:
If I execute generically it install php-gd for 7.3 version
如果我一般执行它会为 7.3 版本安装 php-gd
sudo apt install php-gd
Doing the following, nothing happens:
执行以下操作,没有任何反应:
felipe ? ? php -v
PHP 7.2.24-0ubuntu0.19.04.1 (cli) (built: Oct 24 2019 11:49:39) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.2.24-0ubuntu0.19.04.1, Copyright (c) 1999-2018, by Zend Technologies
enter code here
felipe ? sudo apt install php7.2-gd
Lendo listas de pacotes... Pronto
Construindo árvore de dependências
Lendo informa??o de estado... Pronto
E: Impossível encontrar o pacote php7.2-gd
E: Couldn't find any package by glob 'php7.2-gd'
E: N?o foi possível encontrar o pacote através da express?o regular 'php7.2-gd'
Already tried to do:
已经尝试做:
sudo apt update -y ; sudo apt upgrade -y ; sudo apt full-upgrade -y ;
Does anyone got this error?
有没有人得到这个错误?