18

I've added these lines to /etc/apt/sources.list

deb http://packages.dotdeb.org wheezy-php56 all
deb-src http://packages.dotdeb.org wheezy-php56 all

But still sudo apt-get update or sudo apt-get upgrade don't touch php.

php --version is still

PHP 5.4.39-0+deb7u2 (cli) (built: Mar 25 2015 08:33:29) 

3 Answers 3

26

(Update) Try this (Ubuntu):

sudo add-apt-repository ppa:ondrej/php -y
sudo apt-get update
sudo apt-get install php5.6-fpm -y

(Update) For Debian Wheezy (with sudo)

echo "deb http://packages.dotdeb.org wheezy-php56 all" >> /etc/apt/sources.list.d/dotdeb.list
echo "deb-src http://packages.dotdeb.org wheezy-php56 all" >> /etc/apt/sources.list.d/dotdeb.list
wget http://www.dotdeb.org/dotdeb.gpg -O- | apt-key add - 
apt-get update
apt-get install php5-cli php5-fpm ….. (or whatever package you might need)

(Update 21/06/2017) For Debian 8 (jessie)

sudo nano /etc/apt/sources.list

Add the following repositories:

...
deb http://mirrors.digitalocean.com/debian jessie main contrib non-free
deb-src http://mirrors.digitalocean.com/debian jessie main contrib non-free

deb http://security.debian.org/ jessie/updates main contrib non-free
deb-src http://security.debian.org/ jessie/updates main contrib non-free

# jessie-updates, previously known as 'volatile'
deb http://mirrors.digitalocean.com/debian jessie-updates main contrib non-free
deb-src http://mirrors.digitalocean.com/debian jessie-updates main contrib non-free

Then update your sources:

sudo apt-get update

Then install the php5-fpm

sudo apt-get install php5-fpm
5
  • This doesn't seem to work on wheezy. Perhaps it has been removed? See ppa.launchpad.net/ondrej/php5-5.6/ubuntu/dists
    – danorton
    Commented Nov 7, 2015 at 15:29
  • I updated the reference for Wheezy installation.
    – Alejandro
    Commented Dec 21, 2015 at 21:41
  • This is not working on Debian 8, Why ? Commented Jun 21, 2017 at 8:43
  • @Nullpointer I update the answer
    – Alejandro
    Commented Jun 21, 2017 at 14:08
  • Doesn't work for me on debian 7. It installed php 5.4 which is the one I already had.
    – matteo
    Commented Apr 27, 2019 at 20:23
15
sudo nano /etc/apt/sources.list

add

deb http://packages.dotdeb.org wheezy all
deb-src http://packages.dotdeb.org wheezy all
deb http://packages.dotdeb.org wheezy-php56-zts all
deb-src http://packages.dotdeb.org wheezy-php56-zts all

save and run

sudo apt-get update
sudo apt-get upgrade
sudo apt-get install php5 

more info here https://www.dotdeb.org/instructions/

3
  • 1
    interesting, when I do this I get back php5 is already the newest version. Commented Dec 31, 2015 at 20:35
  • This worked for me.
    – cwiggo
    Commented Feb 5, 2016 at 11:29
  • 1
    I kept getting an error NO_PUBKEY, had to do: gpg --keyserver keys.gnupg.net --recv-key 89DF5277 gpg -a --export 89DF5277 | sudo apt-key add - thanks to: dotdeb.org/2010/07/11/dotdeb-packages-are-now-signed Commented Dec 19, 2016 at 16:41
-1

After you have done apt-get update and apt-get upgrade you'll have to do a install with:

sudo apt-get install php5
1
  • Last version of php in the official wheezy repos is 5.4, so your solution is invalid in this context.
    – matiit
    Commented May 18, 2017 at 9:09

You must log in to answer this question.

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