Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

2 Answers 2

up vote 2 down vote accepted

Debian Wheezy ships with PHP 5.4.4 as can be seen on packages.debian.org. 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: cdimage.debian.org/debian-cd/7.0.0/amd64/iso-cd/… but lsb_release -a shows that Debian 6.0.6 is installed. How could this happen? –  Devils Child 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! –  Devils Child 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 http://packages.dotdeb.org wheezy all
deb-src http://packages.dotdeb.org wheezy all

Install their key:

wget http://www.dotdeb.org/dotdeb.gpg
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? –  Devils Child 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

Your Answer

 
discard

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.