GD库扩展不适用于此PHP安装Ubuntu Nginx

问题描述:

我正在ubuntu 14.04服务器和nginx Web服务器上使用laravel Web框架,当我尝试使用laravel将文件上传到服务器时出现此错误. 我的上传目录位于具有777权限的public/uploads文件夹中.

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.

GD图形库用于动态处理图像. 对于Ubuntu,您应该手动安装它:

The GD Graphics Library is for dynamically manipulating images. For Ubuntu you should install it manually:

  • 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

仅此而已,您可以验证是否已加载GD支持:

That's all, you can verify that GD support loaded:

php -i | grep -i gd

输出应如下所示:

GD Support => enabled
GD headers Version => 2.1.1-dev
gd.jpeg_ignore_warning => 0 => 0