Search code examples
linuxdebiangdphp-5.6linode

Broken dependencies while installing GD Library for php5.6 on Linode server Debian 9


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


Solution

  • 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.