Debian wheezy 将 php 5.4 升级到 5.5

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/27413509/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-25 23:21:43  来源:igfitidea点击:

Debian wheezy upgrade php 5.4 to 5.5

phpdebian

提问by marcin110987

[solved]

[解决了]

I have Debian Wheezy with installed php 5.4.18. I wanted upgrade it to 5.5.x, but standard procedure not working.

我有安装了 php 5.4.18 的 Debian Wheezy。我想将其升级到 5.5.x,但标准程序不起作用。

This is my /etc/apt/sources.list file:

这是我的 /etc/apt/sources.list 文件:

# deb cdrom:[Debian GNU/Linux 7.0.0 _Wheezy_ - Official amd64 NETINST Binary-1 20130504-14:43]/ wheezy main
deb http://ftp.pl.debian.org/debian/ wheezy main
deb-src http://ftp.pl.debian.org/debian/ wheezy main

deb http://security.debian.org/ wheezy/updates main
deb-src http://security.debian.org/ wheezy/updates main

# wheezy-updates, previously known as 'volatile'
deb http://ftp.pl.debian.org/debian/ wheezy-updates main
deb-src http://ftp.pl.debian.org/debian/ wheezy-updates main

#php 5.5
deb http://packages.dotdeb.org wheezy-php55 all
deb-src http://packages.dotdeb.org wheezy-php55 all

I updated sources with

我更新了来源

apt-get update

and installed php5

并安装了php5

apt-get install php5

but after httpd restart i still have old php version.

但是在 httpd 重新启动后,我仍然有旧的 php 版本。

php -v

returns:

返回:

root@xxx:/# php -v
PHP 5.4.18 (cli) (built: Aug 19 2013 04:03:40)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies
    with Xdebug v2.2.1, Copyright (c) 2002-2012, by Derick Rethans

when I searching php

当我搜索 php

find / -name php5

I can see just installed files

我可以看到刚刚安装的文件

root@xxx:/usr/bin# ls -l php*
lrwxrwxrwx 1 root root      21 Dec 11 00:15 php -> /etc/alternatives/php
-rwxr-xr-x 1 root root 8956912 Nov 17 02:37 php5
root@xxx:/usr/bin# ./php5 -v
PHP 5.5.19-1~dotdeb.1 (cli) (built: Nov 17 2014 01:24:08)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies
    with Zend OPcache v7.0.4-dev, Copyright (c) 1999-2014, by Zend Technologies
    with Xdebug v2.2.6, Copyright (c) 2002-2014, by Derick Rethans
root@xxxx:/usr/bin# ./php -v
PHP 5.5.19-1~dotdeb.1 (cli) (built: Nov 17 2014 01:24:08)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies
    with Zend OPcache v7.0.4-dev, Copyright (c) 1999-2014, by Zend Technologies
    with Xdebug v2.2.6, Copyright (c) 2002-2014, by Derick Rethans

My phpinfo returns PHP Version 5.4.18

我的 phpinfo 返回 PHP 版本 5.4.18

What I'm doing wrong?

我做错了什么?

//edit: I updated it by directadmin/custombuild

//编辑:我通过directadmin/custombuild更新了它

root@xxxx:/usr/local/directadmin/custombuild# vim options.conf

i changed line:

我改变了线路:

php1_release=5.4

to

php1_release=5.5

and next:

接下来:

root@xxxx:/usr/local/directadmin/custombuild# ./build update_data
# [..]
root@xxxx:/usr/local/directadmin/custombuild# ./build php d
# [..]

Now I have php 5.5.19, and I can use password_hash() function ;)

现在我有 php 5.5.19,我可以使用 password_hash() 函数;)

回答by Hassan Azimi

  1. Add these package sources to your sources.list file: Enter the file via

    sudo nano /etc/apt/sources.list

  1. 将这些包源添加到您的 sources.list 文件中:通过输入文件

    须藤纳米 /etc/apt/sources.list

and add these lines at the end of the file (right click pastes):

并在文件末尾添加这些行(右键单击粘贴):

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

Save and close (CTRL-X, “y”, ENTER).

保存并关闭(CTRL-X、“y”、ENTER)。

  1. Do an update:

    sudo apt-get update

  1. 做一个更新:

    sudo apt-get 更新

You'll get an error message in the last line of the update progress now.

现在您将在更新进度的最后一行收到一条错误消息。

  1. It's not possible to install PHP now, as Debian just gave an error and said that these new sources are not verified and blah blah, the public key is not available… I find this process highly unintutive and I really don't know why it's so complicated to update PHP, but well, that's how it is…
  1. 现在不可能安装 PHP,因为 Debian 刚刚给出一个错误,并说这些新源没有经过验证,等等,公钥不可用……我觉得这个过程非常不直观,我真的不知道为什么会这样更新 PHP 很复杂,但好吧,就是这样……

Method #1The last line of this error message contains a key, like “E9C74FEEA2098A6E”. Copy that key (mark the string with the mouse usually copies it into the clipboard) and run these commands to verifiy the new package sources (and put YOUR key in here):

方法 #1此错误消息的最后一行包含一个密钥,例如“E9C74FEEA2098A6E”。复制该密钥(用鼠标标记字符串通常将其复制到剪贴板中)并运行这些命令来验证新的包源(并将您的密钥放在此处):

gpg --keyserver packages.dotdeb.org --recv-key  E9C74FEEA2098A6E
gpg -a --export E9C74FEEA2098A6E | sudo apt-key add -

Method #2(thanks Petr for bringing this in!)

方法 #2(感谢 Petr 带来这个!)

wget http://www.dotdeb.org/dotdeb.gpg
sudo apt-key add dotdeb.gpg
  1. Do an update again:

    sudo apt-get update

  2. Install the latest version of PHP 5:

    sudo apt-get install php5

  3. Check the installed version of PHP 5 (phpinfo() will still show old PHP version until apache restart):

    php -v

  1. 再次更新:

    sudo apt-get 更新

  2. 安装最新版本的 PHP 5:

    sudo apt-get 安装 php5

  3. 检查已安装的 PHP 5 版本(phpinfo() 仍会显示旧的 PHP 版本,直到 apache 重新启动):

    php -v

Finally, restart the apache:

最后,重启apache:

sudo service apache2 restart

By the way, it's not possible (as far as I know) to install PHP 5.5 on Debian 6 (without compiling source code manually).

顺便说一句,不可能(据我所知)在 Debian 6 上安装 PHP 5.5(不手动编译源代码)。