First of all, I am sorry if my question may be too vague. So, I will try to clarify my question as much as possible.
I am currently developing a Laravel application, and I am trying to use Intervention Image Facade. When I tried to use it to test an upload, I got the following error:-
NotSupportedException in Driver.php line 16: GD Library extension not available with this PHP installation.
So, as I would try to do, I installed the GD library using sudo apt-get install libgd3
and the php gd driver using sudo apt-get php5.6-gd
. However, this did not work, and the same error keeps popping up in laravel. What have I clearly missed, and what should I follow next?
Edit 1. I used the following command to see if php actually supports gd driver: - php -i | grep -i --color gd
php -i | grep -i --color gd
The following result came: -
/etc/php/5.6/cli/conf.d/20-gd.ini,
gd
GD Support => enabled
GD headers Version => 2.2.3
GD library Version => 2.2.3
gd.jpeg_ignore_warning => 0 => 0
GDM_LANG => en_US
GDMSESSION => ubuntu
_SERVER["GDM_LANG"] => en_US
_SERVER["GDMSESSION"] => ubuntu
Hope this helps even more.
EDIT 2 Thanks to all who answered. I found my solution in Mayank Pandey's answer.
This is because the GD Library is missing on your server.
You must enable the library GD2.
Find your (proper) php.ini
file, and then find the line:
;extension=php_gd2.dll
, remove the semicolon in the front. ;
means the line is commented, so remove the comment)
The line should look like this:
extension=php_gd2.dll
Then restart apache and you are ready to go.
This is because the GD Library is missing on your server For PHP 8.x
For PHP 8.x try the following:
Find your (proper) php.ini file, and then find the line:
;extension=gd
, remove the semicolon in the front. ;
means the line is commented, so remove the comment.
The line should look like this:
extension=gd
Then restart apache and you are ready to go.
NOTE: If You are using php version <=7.x
;extension=php_gd2.dll
, itshould look like this: extension=php_gd2.dll
Install GD extension:
sudo apt-get install php7.0-gd
For PHP 7.1 try the following:
sudo apt-get install php7.1-gd
For PHP 7.2 try the following:
sudo apt-get install php7.2-gd
Then restart your server.
Apache:
sudo service apache2 restart
Nginx:
sudo service nginx restart
Did you enable the gd extension?
try this is your termital
php -i | grep gd
my output is:
frank@frank-ThinkPad-T430:~$ php -i | grep gd
/etc/php/7.0/cli/conf.d/20-gd.ini,
gd
gd.jpeg_ignore_warning => 0 => 0
After all the above failed, I upgraded to php 7.3.x from php7.2.x, using
sudo apt install php
then installed gd
sudo apt-get install php7.3-gd
to be sure, restart the apache server or xampp(as was for my case) and also restart php artisan serve.
Using the appropriate php.ini file, ensure that "extension=php_gd2.dll" is enabled by removing the semicolon that appears before it.
then check what you have on grep through
php -i | grep -i --color gd
it should look like this.
/etc/php/7.3/cli/conf.d/20-gd.ini,
gd
GD Support => enabled
GD headers Version => 2.2.5
GD library Version => 2.2.5
gd.jpeg_ignore_warning => 1 => 1
GDM_LANG => C.UTF-8
GDMSESSION => gnome
XAUTHORITY => /run/user/1000/gdm/Xauthority
$_SERVER['GDM_LANG'] => C.UTF-8
$_SERVER['GDMSESSION'] => gnome
$_SERVER['XAUTHORITY'] => /run/user/1000/gdm/Xauthority
in the case that after this, you get an error concerning drivers on your laravel app, this answer may help solve it. Laravel 5 PDOException Could Not Find Driver
I hope this helps you.
As @nafischonchol said, you should also stop and start php artisan serve
on local after enabling gd extension on php.ini file and stop and start apache.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.