Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Package 'php5-gd' has no installation candidate

Tags:

linux

php

"PHP module gd: Missing" I received such an error. and I'm trying to install php5-gd.

apt-get install php5-gd

I am using Ubuntu 16.10 and PHP version 7. I made all the updates.

When I tried to install php5-gd, I got an error like below.

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Package php5-gd is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package 'php5-gd' has no installation candidate
like image 380
Hakan san Avatar asked Jun 29 '17 09:06

Hakan san


2 Answers

First check which php version you have by sudo php -v. I have php7 so the result is:

PHP 7.0.18-0ubuntu0.17.04.1 (cli) (built: Apr 26 2017 23:59:48) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies
with Zend OPcache v7.0.18-0ubuntu0.17.04.1, Copyright (c) 1999-2017, by Zend Technologies

since i have php7, I will do the following to list the php packages

sudo apt-cache search php7-* 

this returned

libapache2-mod-php7.0 - server-side, HTML-embedded scripting language (Apache 2 module)
php-all-dev - package depending on all supported PHP development packages
php7.0 - server-side, HTML-embedded scripting language (metapackage)
php7.0-cgi - server-side, HTML-embedded scripting language (CGI binary)
php7.0-cli - command-line interpreter for the PHP scripting language
php7.0-common - documentation, examples and common module for PHP
php7.0-curl - CURL module for PHP
php7.0-dev - Files for PHP7.0 module development
php7.0-gd - GD module for PHP
php7.0-gmp - GMP module for PHP
php7.0-json - JSON module for PHP
php7.0-ldap - LDAP module for PHP
php7.0-mysql - MySQL module for PHP
php7.0-odbc - ODBC module for PHP
php7.0-opcache - Zend OpCache module for PHP
php7.0-pgsql - PostgreSQL module for PHP
php7.0-pspell - pspell module for PHP
php7.0-readline - readline module for PHP
php7.0-recode - recode module for PHP
php7.0-snmp - SNMP module for PHP
php7.0-sqlite3 - SQLite3 module for PHP
php7.0-tidy - tidy module for PHP
php7.0-xml - DOM, SimpleXML, WDDX, XML, and XSL module for PHP
php7.0-xmlrpc - XMLRPC-EPI module for PHP
libphp7.0-embed - HTML-embedded scripting language (Embedded SAPI library)
php-amqp - AMQP extension for PHP
php-apcu - APC User Cache for PHP
php-gearman - PHP wrapper to libgearman
php-geoip - GeoIP module for PHP
php-gmagick - Provides a wrapper to the GraphicsMagick library
php-gnupg - PHP wrapper around the gpgme library
php-http - PECL HTTP module for PHP Extended HTTP Support
php-igbinary - igbinary PHP serializer
php-imagick - Provides a wrapper to the ImageMagick library
php-libsodium - PHP wrapper for the Sodium cryptographic library
php-mailparse - Email message manipulation for PHP
php-memcache - memcache extension module for PHP
php-memcached - memcached extension module for PHP, uses libmemcached
php-mongodb - MongoDB driver for PHP
php-msgpack - PHP extension for interfacing with MessagePack
php-oauth - OAuth 1.0 consumer and provider extension
php-pinba - Pinba module for PHP
...and do on

now to install packages run the following command with your desired package

sudo apt-get install php7.0-mysql php7.0-gd php7.0-curl php7.0-recode

note:php7.0-mysql php7.0-gd php7.0-curl php7.0-recode are the package that are listed above.

UPDATE

dont forget to restart apache sudo service apache2 reload

like image 117
Regolith Avatar answered Sep 21 '22 03:09

Regolith


You can use the meta-paclaget php-gd, which is an alias of php7.0-gd

sudo apt-get install php-gd
like image 29
Oliver Avatar answered Sep 24 '22 03:09

Oliver