Package 'Php5-Gd' Has No Installation Candidate

Package 'php5-gd' has no installation candidate

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

php7 for imagecreatefromjpeg - Package 'php5-gd' has no installation candidate?

According to PHP.nethttp://php.net/manual/en/image.installation.php#120116

sudo apt-get install php7.0-gd

Package php5 has no installation candidate on Ubuntu 16.04 LTS

Ubuntu 16.04 comes with PHP7 ,there are no PHP5 packages.
Remove all php7 packages:

sudo aptitude purge `dpkg -l | grep php| awk '{print $2}' |tr "\n" " "

New PPA

sudo add-apt-repository ppa:ondrej/php

Update packages:

sudo apt-get update

Install PHP:

sudo apt-get install php5.6

Check PHP Version:

php -v

Package php5 have no installation candidate (Ubuntu 16.04)

Ubuntu 16.04 comes with PHP7 as the standard, so there are no PHP5 packages

However if you like you can add a PPA to get those packages anyways:

Remove all the stock php packages

List installed php packages with dpkg -l | grep php| awk '{print $2}' |tr "\n" " " then remove unneeded packages with sudo aptitude purge your_packages_here or if you want to directly remove them all use :

sudo aptitude purge `dpkg -l | grep php| awk '{print $2}' |tr "\n" " "`

Add the PPA

sudo add-apt-repository ppa:ondrej/php

Install your PHP Version

sudo apt-get update
sudo apt-get install php5.6

You can install php5.6 modules too ..

Verify your version

sudo php -v

Based on https://askubuntu.com/a/756186/532957 (thanks @AhmedJerbi)

PHP5-Curl install error no installation candidate

Use sudo apt-get install php5.6-curl

Can't install php5.6-gd in docker container

Here you can find working Dockerfile for what you need.

Relevant part:

FROM php:5.6-fpm
(...)
RUN apt-get update && \
apt-get install -y --no-install-recommends \
curl \
libmemcached-dev \
libz-dev \
libpq-dev \
libjpeg-dev \
libpng12-dev \
libfreetype6-dev \
libssl-dev \
libmcrypt-dev

(...)
# Install the PHP gd library
RUN docker-php-ext-install gd && \
docker-php-ext-configure gd \
--enable-gd-native-ttf \
--with-jpeg-dir=/usr/lib \
--with-freetype-dir=/usr/include/freetype2 && \
docker-php-ext-install gd

Debian 9: the php5 packages is not installed

The package libapache2-mod-php5.6, php5-dev, php5-mysql,php5-curl can be installed only on debian Wheezy (7) , Jessie (8) or Sid . Also the ondrej/php repository does not provide those package for debian Stretch it is only provide the php5.6 package.

The command sudo apt-get install php-dev will install the development module for PHP7 :

dh-php libssl-dev libssl-doc php7.1-cli php7.1-common php7.1-dev php7.1-json 
php7.1-opcache php7.1-readline pkg-php-tools shtool xml2

PHP GD library is NOT installed but it has been enabled actually

I finally got it working following these 3 steps:

  1. uninstalled PHP and all its libs from my machine following this answer.
  2. upgraded Ubuntu to 18.04 following this guide.
  3. installed PHP 7.2 following this guide.*

On my terminal:

$ sudo apt-get install php

$ sudo apt-get install php-pear php-fpm php-dev php-zip php-curl php-xmlrpc php-gd php-mysql php-mbstring php-xml libapache2-mod-php

$ php -v
PHP 7.2.5-0ubuntu0.18.04.1 (cli) (built: May 9 2018 17:21:02) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.2.5-0ubuntu0.18.04.1, Copyright (c) 1999-2018, by Zend Technologies

$ sudo systemctl restart apache2

Result:

Sample Image

It took a few hours but worth it!



Related Topics



Leave a reply



Submit