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
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
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.
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