如何在Debian GNU / Linux 7上将PHP 5.4升级到PHP 5.6(简述)


18

我已经将这些行添加到 /etc/apt/sources.list

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

但是还是sudo apt-get update还是sudo apt-get upgrade不要碰PHP。

php --version 还是

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

Answers:


26

更新)试试这个(Ubuntu):

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

(更新) 对于Debian Wheezy(带有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)

(更新21/06/2017) 对于Debian 8(jessie)

sudo nano /etc/apt/sources.list

添加以下存储库:

...
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

然后更新您的来源:

sudo apt-get update

然后安装php5-fpm

sudo apt-get install php5-fpm

这似乎不适用于喘息。也许它已被删除?参见ppa.launchpad.net/ondrej/php5-5.6/ubuntu/dists
danorton 2015年

我更新了Wheezy安装的参考。
Ale

这不起作用Debian 8,为什么?
Nullpointer

@Nullpointer我更新了答案
Ale

在debian 7上对我不起作用。它安装了php 5.4,这是我已经拥有的。
matteo

15
sudo nano /etc/apt/sources.list

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

保存并运行

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

更多信息在这里 https://www.dotdeb.org/instructions/


1
有趣的是,当我这样做时,我会回来php5 is already the newest version.
lfender6445

这对我有用。
cwiggo '02

1
我不断收到错误NO_PUBKEY,必须这样做:gpg --keyserver keys.gnupg.net --recv-key 89DF5277 gpg -a --export 89DF5277 | sudo apt-key add - 多亏了:dotdeb.org/2010/07/11/dotdeb-packages-are-now-signed
user3413723

-1

完成后apt-get updateapt-get upgrade您必须使用以下命令进行安装:

sudo apt-get install php5

官方的wheezy存储库中的php的最新版本是5.4,因此您的解决方案在此情况下无效。
matiit
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.