Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to install php5-gd and receive this error

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

I am not sure why this would be, I checked dpkg -l | grep php and noticed php5-gd was installed at one point. I am not sure why it or how it was removed but I need it installed.

dpkg -l | grep php
rc  php5-gd                         5.2.10.dfsg.1-2ubuntu6                          GD module for php5
ii  libapache2-mod-php5             5.2.10.dfsg.1-2ubuntu6                          server-side, HTML-embedded scripting languag
ii  php5                            5.2.10.dfsg.1-2ubuntu6                          server-side, HTML-embedded scripting languag
ii  php5-cli                        5.2.10.dfsg.1-2ubuntu6                          command-line interpreter for the php5 script
ii  php5-common                     5.2.10.dfsg.1-2ubuntu6                          Common files for packages built from the php
ii  php5-mysql                      5.2.10.dfsg.1-2ubuntu6                          MySQL module for php5

I have checked my sources.list, here it is: (the paste was too long so I opt'd to use a paste service)

I have ran apt-get update as well to be sure.

Could anyone recommend how I can fix this so I can get php5-gd installed?

share|improve this question
Show us output of: apt-cache policy php5-common – oerdnj Apr 24 '13 at 6:38
up vote 2 down vote accepted

My reputation isn't big enough to comment, but here is what I wanted to say:

Did you try adding another mirror to your sources? Example:
create a new file called /etc/apt/sources.list.d/alternative_Repo.list containing this:

deb lucid main restricted
deb-src lucid main restricted

This will make sure that your package manager has access to an up-to-date official mirror in case your main mirror is lagging behind.

I looked at and is quite behind in many countries. Due to how mirrors works, they can't be up to date all the time. In the netherlands, as example, it's pretty bad: http ftp rsync 1 Gbps Last update unknown

I hope it helps!

share|improve this answer

Installation GD.

sudo apt-get install php5-gd && sudo service apache2 restart

Some time error in your php library. So try to update also.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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