4

I want to install GD Library for php5.6 on Linode Server Debian 9

I run apt-get install php5.6-gd

Output is:

php5.6-gd : Depends: libgd3 (>= 2.1.1) but it is not going to be installed

then I tried to install that package apt-get install libgd3 output is:

 libgd3 : Depends: libfontconfig1 (>= 2.11.94) but 2.11.0-6.7+b1 is to be installed
 Depends: libjpeg8 (>= 8c) but it is not installable

I tried to install the mentioned version by running command apt-get install libfontconfig1=2.11.94

Output is:

Version '2.11.94' for 'libfontconfig1' was not found

I checked the available versions of libfontconfig1 package by running :

apt-cache policy libfontconfig1

Output is :

libfontconfig1:

 Installed: 2.11.0-6.7+b1
 Candidate: 2.11.0-6.7+b1
 Version table:
2.11.0-6.7+b1 500
       500 http://mirrors.linode.com/debian stretch/main amd64 Packages
       100 /var/lib/dpkg/status

I didn’t find the (>= 2.11.94) version available.

Output of cat /etc/apt/sources.list

# deb http://mirrors.linode.com/debian/ stretch main

deb http://mirrors.linode.com/debian/ stretch main
deb-src http://mirrors.linode.com/debian/ stretch main

deb http://security.debian.org/debian-security stretch/updates main
deb-src http://security.debian.org/debian-security stretch/updates main

deb http://ftp.de.debian.org/debian stretch main

Output of cat /etc/apt/sources.list.d/*enter image description here

  • Welcome to stackoverflow , please [edit here](https://stackoverflow.com/posts/47375168/edit) by adding the output of `cat /etc/apt/sources.list` and `cat /etc/apt/sources.list.d/*` – GAD3R Nov 19 '17 at 11:12
  • related https://stackoverflow.com/questions/46378017/install-php5-6-in-debian-9/46390370#46390370 – GAD3R Nov 19 '17 at 11:19
  • This solution https://stackoverflow.com/a/47388417/6932646 is still working for me – Mario Tilli Apr 03 '19 at 15:45

2 Answers2

4

The problem is that http://ppa.launchpad.net/ondrej/php/ubuntu contains conflicting version of libgd3.

vagrant@localhost:~$ sudo apt-cache policy libgd3
libgd3:
  Installed: (none)
  Candidate: 2.2.5-3+ubuntu16.04.1+deb.sury.org+1
  Version table:
     2.2.5-3+ubuntu16.04.1+deb.sury.org+1 500
        500 http://ppa.launchpad.net/ondrej/php/ubuntu xenial/main amd64 Packages
     2.2.4-2+deb9u2 500
        500 http://deb.debian.org/debian stretch/main amd64 Packages
        500 http://security.debian.org/debian-security stretch/updates/main amd64 Packages

You need to install version from official repository like next:

vagrant@localhost:~$ sudo apt-get install libgd3=2.2.4-2+deb9u2

I hope this helps.

metamaker
  • 2,307
  • 2
  • 19
  • 18
3

On debian stretch your /etc/apt/sources.list.d/php.list should contain only the following line :

deb https://packages.sury.org/php/ stretch main

You need to uncomment the above line (remove #) and keep the others ppa disabled (you don't need them).

The dependency problem come from the artuful ppa when enabled. To solve your problem , open the terminal then run the following command:

rm /etc/apt/sources.list.d/*
apt install apt-transport-https lsb-release ca-certificates curl
echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list
curl https://packages.sury.org/php/apt.gpg | apt-key add -
apt update
apt upgrade
apt dist-upgrade
apt install php5.6

Use the update-alternatives --config php to switch between php version.

GAD3R
  • 4,317
  • 1
  • 23
  • 34