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
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.
Without pictures, websites would be fairly boring.
However, compressing or cropping images, doing greyscale, etc. can be time-consuming and often error-prone.
Fortunately, using the PHP GD extension take care of all your basic image edit requirements.
At Bobcares, we often get requests to install PHP gd extension as part of our Server Management Services.
Today, let’s get into the details and see how our Support Engineers manage PHP install gd extension and fix errors.
How we install GD library for PHP on CentOS
The GD library is a library that offers graphics drawing tools to manage image data. By default, it may not be installed on the server. So, we have to install the GD library manually.
Here, let’s see how our Support Engineers install a GD library for PHP on CentOS
Before getting into the installation procedure, we make sure that if it’s already installed with the following command.
rpm -qa | grep gd
If not, we follow the below steps to install a gd extension.
1. We run the below command to install a gd extension.
yum install php-gd
2. Then, we restart the apache as follows.
service httpd restart
That’s it!. Here we have installed the gd library.
Similarly, adding GD library support involves executing the command:
sudo apt-get install php7.0-gd
After that, we create info.php with one line of code to test whether or not the gd extension is enabled on the server.
For example, after enabling the extension, the output looks like:
How we fix the gd extension installation errors
At Bobcares, where we have more than a decade of expertise in managing servers, we see many customers face problems while installing gd extension on the server.
Now, let’s see the major reasons for installation error and how our Support Engineers fix the top errors.
1. Missing package
Recently, one of our customers had a problem with the gd extension. He had installed php71w-gd and still had this error when uploading a file. The error said,
Intervention Image Exception NotSupportedException
GD Library extension not available with this PHP installation.
On checking, our Support Engineers found that he was using the Laravel web framework on the CentOS7 server and Nginx web server. Also, the gd package was not installed properly.
That means GD Library was missing on the server.
Therefore, we reinstalled php71 and php-gd from Remi’s RPM repository by running this code.
yum --enablerepo=remi-php71 install php-gd
Then, we restarted Nginx and PHP-FPM.
systemctl restart nginx
systemctl restart php-fpm
This is how we fixed the error.
2. Missing configuration in php.ini
Every domain has its own php.ini file. It contains information on how PHP applications run under the domain.
Therefore, it should also be enabled in php.ini after installing the module server-wide. Then only the module can take effect on the corresponding domains.
Sometimes, customers may forget to enable it in the php.ini file which results in an error like.
NotSupportedException in Driver.php line 16: GD Library extension not available with this PHP installation.
Then, our Support Engineers add the following line to the php.ini file. If the domain is on a Windows server, we add
extension=php_gd2.dll
Or in a Linux server, we uncomment the line:
extension=php_gd.so
Then, we restart the web server for the changes to take effect.
In Apache,
systemctl restart apache
Or in Nginx,
systemctl restart nginx
This fixes the error and the website works normally.
[Need assistance in tasks like PHP install gd extension? We’ll help you.]
Conclusion
In short, a GD library is a graphics drawing library that provides tools for modifying image data. Today, we saw the topmost reasons for the gd extension installation errors and how our Support Engineers manage PHP install gd extension.
PREVENT YOUR SERVER FROM CRASHING!
Never again lose customers to poor server speed! Let us help you.
Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.
GET STARTED
var google_conversion_label = «owonCMyG5nEQ0aD71QM»;
Hi Dev,
This post will give you example of php error — gd library extension not available with this php installation — solved. let’s discuss about gd library extension not available with this php installation solved error. Here you will learn install gd library extension. I would like to show you how to solve gd library extension not available with this php installation error.
Here, I will give the Solved to GD Library extension not available with this PHP installation php Error.in this example, we will solve this error using some sudo command.
Solution: PHP 8.1
You need to install gd library using the below command:
sudo apt-get install php8.1-gd
Then, restart apache server by following command:
sudo service apache2 restart
Solution: PHP 8.0
You need to install gd library using the below command:
sudo apt-get install php8.0-gd
Then, restart apache server by following command:
sudo service apache2 restart
Solution: PHP 7.4
You need to install gd library using the below command:
sudo apt-get install php7.4-gd
Then, restart apache server by following command:
sudo service apache2 restart
Solution: PHP 7.3
You need to install gd library using the below command:
sudo apt-get install php7.3-gd
Then, restart apache server by following command:
sudo service apache2 restart
Solution: PHP 7.2
You need to install gd library using the below command:
sudo apt-get install php7.2-gd
Then, restart apache server by following command:
sudo service apache2 restart
Solution: PHP 7.1
You need to install gd library using the below command:
sudo apt-get install php7.1-gd
Then, restart apache server by following command:
sudo service apache2 restart
Solution: PHP 7.0
You need to install gd library using the below command:
sudo apt-get install php7.0-gd
Then, restart apache server by following command:
sudo service apache2 restart
Solution: PHP 5
You need to install gd library using the below command:
sudo apt-get install php5-gd
Then, restart apache server by following command:
sudo service apache2 restart
I hope it could help you…
✌️ Like this article? Follow me on Twitter and Facebook. You can also subscribe to RSS Feed.
425 votes
9 answers
Get the solution ↓↓↓
I am usingLaravel
web framework on myubuntu 14.04
server andNginx
web server, I have this error when I try to upload a file usingLaravel
to the server.
my upload directory is on thepublic/uploads
folder that has 777 permission.
2021-12-24
Write your answer
799
votes
Answer
Solution:
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
- PHP8.0:
sudo apt-get install php8.0-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
and finally restart your apache:
sudo service apache2 restart
825
votes
Answer
Solution:
window users using xampp apache server.
Go to php folder in xampp and open the php.ini and php configurations settings file, and
change the line ;extension=gd2 or the line ;extension=gd to just extension=gd2
NB that php version 8 is stored as ;extension=gd
290
votes
Answer
Solution:
@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 toPHP 7.0.8-0ubuntu0.16.04.2 (cli) ( NTS )
.
40
votes
Answer
Solution:
For my fellow Windows users, find the line;extension=gd2
in yourphp.ini
file and change it toextension=gd2
.
Regards
648
votes
Answer
Solution:
for php -v 7.1
sudo apt-get install php7.1-gd
works for me
155
votes
Answer
Solution:
Php 5.6 worked with below command
PHP5.6:sudo apt-get install php5.6-gd
after installing restart server
sudo service apache2 restart
669
votes
Answer
Solution:
In my case under Archlinux:
pacman -S php-gd
php-gd
then in yourphp.ini
for me in/etc/php/php.ini
uncomment line;extension=gd.so
by removing semicolon.
Don’t forget to restart the server.
947
votes
Answer
Solution:
If you are using Xampp PHP Version 8.* , on xampp control panel, click on config under apache and selectPHP(php.ini)
, this will open php.ini config file. Search for;extension=gd
and Change it toextension=gd
. It is not a must you follow this process to get to php.ini, the most important thing is that you have to change;extension=gd
toextension=gd
on php.ini config file. Restart Xampp and that is it!
884
votes
Answer
Solution:
Go to your xampp serve:
After that, you just click on the Apache config button and you get an option onPHP(php.ini)
. Click this option and then it will be open on code editor.
After that, you will search a filegd
and you get;extension=gd
this option. Remove the;
fromextension=gd
and then save it.
Then restart your server again, then it will be work properly.
Share solution ↓
Additional Information:
Date the issue was resolved:
2021-12-24
Link To Source
Link To Answer
People are also looking for solutions of the problem: cannot add or update a child row: a foreign key constraint fails
Didn’t find the answer?
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Similar questions
Find the answer in similar questions on our website.
@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 )
.
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
- PHP8.0:
sudo apt-get install php8.0-gd
- PHP8.1:
sudo apt-get install php8.1-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
and finally restart your apache:
sudo service apache2 restart
For my fellow Windows users, find the line ;extension=gd2
in your php.ini
file and change it to extension=gd2
.
Regards
window users using xampp apache server.
Go to php folder in xampp and open the php.ini and php configurations settings file, and
change the line ;extension=gd2 or the line ;extension=gd to just extension=gd2
NB that php version 8 is stored as ;extension=gd
Tags:
Nginx
Php
Ubuntu
Laravel
Related
Автор оригинала: David Wong.
При загрузке обложки статьи backstage мы столкнулись с такой ошибкой:
GD Library extension not available with this PHP installation Ubuntu Nginx
Я использовал его в локальной среде разработки Вмешательство/образ
, но после развертывания кода на сервере, чтобы включить расширение GD, мы столкнулись с этой ошибкой при использовании и нашли решение через поисковую систему. Простое резюме состоит в том, чтобы установить соответствующую версию библиотеки GD. Потому что это переполнение стека, и он медленно открывается, поэтому я поделюсь им здесь. Вот основной перевод оригинального текста. Библиотека графических расширений GD-это расширение PHP, которое может динамически обрабатывать изображения. Вы должны установить его вручную на 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
Выше приведена командная операция, соответствующая каждой версии Ubuntu. Вы можете убедиться, что расширение GD включено, выполнив следующую команду.
Нормальный выходной сигнал должен быть следующим:
GD Support => enabled GD headers Version => 2.1.1-dev gd.jpeg_ignore_warning => 0 => 0
Эта статья автоматически публикуется artipub
-
Метки
extension, library