Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to install PHP GD in Ubuntu

Tags:

I want to convert the image in low resolution with GD. I'm working on IBM Server under these speces Version: PHP 7.0.15-0ubuntu0.16.04.4 (cli) ( NTS )
and I have also comment out the extension from php.ini but can't enabled the GD on php server. I Just received this error.

Run Command: sudo apt-get install libgd

Reading package lists... Done

Building dependency tree Reading state information... Done E: Unable to locate package libgd

Second Command When I run give this message:

1) packages have unmet dependencies

and after running this command received this:

Command: sudo apt-get install libgd-dev

Reading package lists... Done

Building dependency tree

Reading state information... Done

You might want to run 'apt-get -f install' to correct these:

The following packages have unmet dependencies: libgd-dev : Depends: libgd3 (= 2.1.1-4ubuntu0.16.04.6) but it is not going to be installed

         Depends: libpng-dev           Depends: libz-dev           Depends: libjpeg-dev           Depends: libfreetype6-dev but it is not going to be installed           Depends: libxpm-dev but it is not going to be installed           Depends: libx11-dev but it is not going to be installed           Depends: libxt-dev but it is not going to be installed           Depends: libfontconfig-dev           Depends: libvpx-dev but it is not going to be installed           Depends: libtiff-dev 

linux-image-virtual : Depends: linux-image-4.4.0-81-generic but it is not going to be installed

E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).

Cause of this Problem:

PHP Fatal error: Uncaught Error: Call to undefined function imagecreatefromstring()

Note please anyone tell me the step-by-step command to enable this GD Library on my this Linus machine. thanks alot

like image 860
Abdul Moeed Chohan Avatar asked Jun 23 '17 10:06

Abdul Moeed Chohan


People also ask

What does PHP GD do?

GD is an open source code library for the dynamic creation of images. GD is used for creating PNG, JPEG and GIF images and is commonly used to generate charts, graphics, thumbnails on the fly.

How do I enable PHP GD on Ubuntu?

Installing PHP-GD. Follow the below simple steps to enable GD extension on Ubuntu and Debian system. $ sudo apt-get install php5-gd. After installation is complete, restart the Apache web server using below command. $ sudo service apache2 restart. Now verify the PHP GD support is enabled or not using below command.

How to install PHP-GD extension on Ubuntu/Debian?

Installing PHP-GD. Follow the below simple steps to enable GD extension on Ubuntu and Debian system. $ sudo apt-get install php5-gd. After installation is complete, restart the Apache web server using below command. $ sudo service apache2 restart. Now verify the PHP GD support is enabled or not using below command. $ php -i | grep -i --color gd.

How to install PHP GB on Ubuntu using apt-get?

How to install PHP GB on Ubuntu using apt-get, specifically php5-gd. To install PHP GD on Ubuntu enter the following command: Check the packages Apt needs to install and press Y then enter.

How to install php5-gd in Apt?

Check the packages Apt needs to install and press Y then enter. Apt will then pull down all the packages that php5-gd depends on and install them, you will need to restart Apache for PHP GD to load. Check that GD is loaded using a phpinfo script.


Video Answer


1 Answers

sudo apt-get update 

For 5.6 PHP

sudo apt-get install php5.6-gd 

For 7.0 PHP

sudo apt-get install php7.0-gd 

For 8.0 PHP

sudo apt-get install php8.0-gd 
like image 138
Andrei Todorut Avatar answered Sep 22 '22 08:09

Andrei Todorut