Super User is a question and answer site for computer enthusiasts and power users. 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

PHP 5.4 is stable for quite some time now. However, when I type

apt-get install php5

PHP 5.3 gets installed.

Question: Why? And what is the preferred way of installing PHP 5.4? Should I choose a different package or should I change the sources? If so, what exactly is the name of the other package or source?

Background information

The server is running Debian Wheezy x64.

share|improve this question
up vote 2 down vote accepted

Debian Wheezy ships with PHP 5.4.4 as can be seen on Are you sure that you have Debian 7.0 Wheezy installed? You can test that by running the lsb_release -a command.

Look at /etc/apt/sources.list and /etc/apt/sources.list.d/ too. Do not forget to run apt-get update prior to apt-get install.

share|improve this answer
That's very weird. I downloaded and installed this image:… but lsb_release -a shows that Debian 6.0.6 is installed. How could this happen? – bytecode77 May 17 '13 at 21:43
@DevilsChild Are you sure about that? Could it be that you used an older image instead of the downloaded one? It seems unlikely to me that the Debian installer has such a severe issue. – Lekensteyn May 17 '13 at 22:09
I'm sorry for that. It rather seems like I messed something up here. With Wheezy installed, PHP 5.4 works. Thank you! – bytecode77 May 17 '13 at 22:14

One way to get PHP latest stable 5.4 on Debian is to install it through the dotdeb repositories. Add to your sources.list:

deb wheezy all
deb-src wheezy all

Install their key:

cat dotdeb.gpg | sudo apt-key add -

Finally run apt-get update. You now get the latest PHP version, including all the extras. Do note that PHP 5.4 does not contain Suhosin – I ran into that problem myself and was wondering why apt-get wouldn't update it.

The benefit of using the dotdeb repos is that they also work on Squeeze (just use squeeze in the sources.list).

share|improve this answer
I did this (because I can't upgrade to Wheezy right now) and now, everytime I call a page on my web site, I retrieve a file called "download" with the PHP source code. What should I do? – bytecode77 May 23 '13 at 14:27
Looks like PHP isn't properly configured or not loaded as a module. See: PHP files are downloaded instead of getting interpreted – if that doesn't help I would suggest you ask this as a new question though and include the details about your OS, what you did, and possibly include the output you got from installing the packages, and your httpd.conf file. – slhck May 23 '13 at 14:33

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .