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

This question already has an answer here:

I've completely destroyed everything and now php wont install.

I had php5.4 and everything was great. I then needed to run Magento locally which wasnt working.

I saw one of the requirements was php5.3 so I downgraded using a script i found online but then PDO wasnt working.

I stuffed about for a few hours following what people said online, eventually nothing was working so i purged php to do a fresh install of php5.4 to start again from scratch and figure out my problems.

After i purged, i came to reinstall Php5 using apt-get install php5. Once the script ran i got the following output:

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 : Depends: libapache2-mod-php5 (>= 5.4.9-4ubuntu2.4) but 5.3.10-1ubuntu3 is to     be installed or
                 libapache2-mod-php5filter (>= 5.4.9-4ubuntu2.4) but it is not going to be installed or
             php5-cgi (>= 5.4.9-4ubuntu2.4) but it is not going to be installed or
             php5-fpm (>= 5.4.9-4ubuntu2.4) but it is not going to be installed
    Depends: php5-common (>= 5.4.9-4ubuntu2.4) but 5.3.10-1ubuntu3 is to be installed
E: Unable to correct problems, you have held broken packages.

I then googled for ages and ran commands like clean, update, upgrade, -f install and a few others. I come back to install php and i get the same error.

How can I reinstall Php so it works again.

share|improve this question

marked as duplicate by Warren Hill, Radu Rădeanu, BuZZ-dEE, Eric Carvalho, Lucio Jan 11 '14 at 0:31

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

I followed all the instructions, couldnt get it to work. – Dustin Silk Jan 10 '14 at 9:58
up vote 1 down vote accepted

Try this command,

sudo aptitude install php5

It will install php5 along with it's dependencies.

share|improve this answer

try this :

sudo rm -r /var/lib/apt/lists/* && sudo apt-get update

then try to install your

share|improve this answer

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