GD Library extension not available with this PHP i

2019-03-09 17:40发布

问题:

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.

回答1:

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

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

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


回答2:

@limonte's answer is correct, but if you're using PHP7+, you should use following command:

sudo apt-get install php7.0-gd

If you don't know what version of PHP you're using, just type

php -v

Output should start with something similar to PHP 7.0.8-0ubuntu0.16.04.2 (cli) ( NTS ).



回答3:

for php -v 7.1

sudo apt-get install php7.1-gd

works for me



回答4:

In my case under Archlinux:

pacman -S php-gd 

php-gd

then in your php.ini for me in /etc/php/php.ini uncomment line ;extension=gd.so by removing semicolon.

Don't forget to restart the server.



回答5:

Php 5.6 worked with below command

PHP5.6: sudo apt-get install php5.6-gd

after installing restart server

sudo service apache2 restart