0

I am installing the php gd5 component but getting some unusual errors, which I don't understand. It worked fine on my local server but on VPS I am facing this problem.

Here is the command:
apt-get install php5-gd

and the error:

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:
php5-gd : Depends: libgd3 (>= 2.1.0~alpha~) but it is not going to be installed
Depends: phpapi-20121212
Depends: php5-common (= 5.5.9+dfsg-1ubuntu4.14) but 5.6.14+dfsg-1+deb.sury.org~precise+1 is to be installed
php5-imagick : Depends: libmagickcore4 (>= 8:6.6.9.7) but it is not installable
Depends: libmagickwand4 (>= 8:6.6.9.7) but it is not installable
Depends: phpapi-20100525 but it is not installable
Recommends: ghostscript
Recommends: ttf-dejavu-core but it is not going to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).

On try with apt-get -f here is what I get:

apt-get -f install php5-gd

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:
 php5-gd : Depends: libgd3 (>= 2.1.0~alpha~) but it is not going to be installed
           Depends: phpapi-20121212
           Depends: php5-common (= 5.5.9+dfsg-1ubuntu4.14) but 5.6.14+dfsg-1+deb.sury.org~precise+1 is to be installed
 php5-imagick : Depends: libmagickcore4 (>= 8:6.6.9.7) but it is not installable
                Depends: libmagickwand4 (>= 8:6.6.9.7) but it is not installable
                Depends: phpapi-20100525 but it is not installable
                Recommends: ghostscript
                Recommends: ttf-dejavu-core but it is not going to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).

On Running apt-get -f install (no package)

apt-get -f install

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Correcting dependencies... Done
The following packages will be REMOVED:
  php5-imagick
0 upgraded, 0 newly installed, 1 to remove and 111 not upgraded.
1 not fully installed or removed.
After this operation, 476 kB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 73412 files and directories currently installed.)
Removing php5-imagick (3.1.0~rc2-1~precise+1) ...
sed: can't read /etc/php5/conf.d/imagick.ini: No such file or directory
dpkg: error processing package php5-imagick (--remove):
 subprocess installed post-removal script returned error exit status 2
Errors were encountered while processing:
 php5-imagick
E: Sub-process /usr/bin/dpkg returned an error code (1)

Any one has an idea how to fix these ?

After trying few more things:

root@vps:~# mkdir /etc/php5/conf.d/
root@vps:~# touch /etc/php5/conf.d/imagick.ini
root@vps:~# apt-get -f install
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages will be REMOVED:
  php5-imagick
0 upgraded, 0 newly installed, 1 to remove and 111 not upgraded.
1 not fully installed or removed.
After this operation, 476 kB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 73398 files and directories currently installed.)
Removing php5-imagick (3.1.0~rc2-1~precise+1) ...
root@vps:~# apt-get install php5-gd
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 php5-gd : Depends: phpapi-20121212
           Depends: php5-common (= 5.5.9+dfsg-1ubuntu4.14) but 5.6.14+dfsg-1+deb.sury.org~precise+1 is to be installed
E: Unable to correct problems, you have held broken packages.

When I install the ones its saying, I get no installation candidate.

Thanks

  • Have you tried apt-get update? – ForceMagic Apr 25 '16 at 8:41
  • Yes... I tried that – viv Apr 25 '16 at 8:44
  • Add output of apt-cache policy php5-common php5-gd php5-imagick. – oerdnj Apr 25 '16 at 9:36
0

ok so finally this worked out: https://stackoverflow.com/questions/30285453/error-installing-php5-mcrypt

sudo add-apt-repository -r ppa:ondrej/php5
sudo add-apt-repository -r ppa:ondrej/php5-oldstable
sudo add-apt-repository -r ppa:ondrej/php5-5.6
sudo apt-get purge php5* apache2* mcrypt*
sudo apt-get update
sudo apt-get upgrade

sudo apt-get install php5 php5-mcrypt php5-curl apache2

sudo php5enmod mcrypt
sudo php5enmod curl

sudo apt-get install php5-gd

Thanks to every one that helped me out.

  • This is horrible, horrible, horrible. Adding ppa:ondrej/php5-5.6 together with ppa:ondrej/php5 and ppa:ondrej/php5-oldstable will bring you nothing at all, as you need exactly one of these. Purging php5* and apache2* is also not necessary. And then mcrypt and curl modules will get enabled automatically (unless you have disabled them in the past), so php5enmod mcrypt and php5enmod curl is extra (but not harmful). – oerdnj Apr 25 '16 at 10:07
0

These errors are usually (without apt-cache policy on missing packages it's hard to say) manifestation of:

  1. Not using the PPA at all, check whether /etc/apt/sources.list.d/ contains the ondrej-php5-5_6-trusty.list file and it's not empty or commented out. If the file doesn't exist, you should add it back using: sudo add-apt-repository ppa:ondrej/php5-5.6 and proceed as normal.

  2. Using architecture that's not supported in the PPA. I think this is your case and the VPS is running on a Raspberry Pi 2 or 3. armhf support was added only recently to the ppa:ondrej/php5 and ppa:ondrej/php5-5.6, so there still might be some packages that weren't recompiled and arm64 (for RPi 3) is not enabled yet at all. I will enable arm64 architecture in both of those PPAs, but it will take some time for everything to recompile.

  • You are correct the ondrej repo worked out, check my answer. – viv Apr 25 '16 at 10:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.