繁体   English   中英

在Ubuntu Trusty上处理php5.4

[英]Dealing with php5.4 on Ubuntu Trusty

我想在我的ubuntu服务器上安装php 5.4,即使它不再受支持。

然后我尝试了这样的ppa:ondrej / php5-oldstable存储库:

sudo add-apt-repository ppa:ondrej/php5-oldstable

但它在下面添加了存储库

[ubuntu@nixmind~]$ cat /etc/apt/sources.list.d/ondrej-php5-oldstable-trusty.list 
    deb http://ppa.launchpad.net/ondrej/php5-oldstable/ubuntu trusty main
    # deb-src http://ppa.launchpad.net/ondrej/php5-oldstable/ubuntu trusty 

主要

并且还在使用apt-cache策略给php5.5.9。

[ubuntu@nixmind ~]$ apt-cache policy php5
php5:
  Installed: 5.4.45-3+donate.sury.org~precise+3
  Candidate: 5.5.9+dfsg-1ubuntu4.17
  Version table:
     5.5.9+dfsg-1ubuntu4.17 0
        500 http://eu-west-1.ec2.archive.ubuntu.com/ubuntu/ trusty-updates/main amd64 Packages
        500 http://security.ubuntu.com/ubuntu/ trusty-security/main amd64 Packages
     5.5.9+dfsg-1ubuntu4 0
        500 http://eu-west-1.ec2.archive.ubuntu.com/ubuntu/ trusty/main amd64 Packages

然后我手动添加精确的repos,如下所示:

[ubuntu@nixmind ~]$ cat /etc/apt/sources.list.d/ondrej-php5-oldstable-trusty.list 
deb http://ppa.launchpad.net/ondrej/php5-oldstable/ubuntu trusty main
deb http://ppa.launchpad.net/ondrej/php5-oldstable/ubuntu precise main 
deb-src http://ppa.launchpad.net/ondrej/php5-oldstable/ubuntu precise main 
# deb-src http://ppa.launchpad.net/ondrej/php5-oldstable/ubuntu trusty main

并有这个:

[ubuntu@nixmind ~]$ apt-cache policy php5
php5:
  Installed: (none)
  Candidate: 5.5.9+dfsg-1ubuntu4.17
  Version table:
     5.5.9+dfsg-1ubuntu4.17 0
        500 http://eu-west-1.ec2.archive.ubuntu.com/ubuntu/ trusty-updates/main amd64 Packages
        500 http://security.ubuntu.com/ubuntu/ trusty-security/main amd64 Packages
     5.5.9+dfsg-1ubuntu4 0
        500 http://eu-west-1.ec2.archive.ubuntu.com/ubuntu/ trusty/main amd64 Packages
     5.4.45-3+donate.sury.org~precise+3 0
        500 http://ppa.launchpad.net/ondrej/php5-oldstable/ubuntu/ precise/main amd64 Packages

我然后像这样安装php5.4:

sudo apt-get install php5=5.4.45-3+donate.sury.org~precise+3

但是php说版本是5.5.9,apt-cache策略说它是5.4

[ubuntu@nixmind ~]$ apt-cache policy php5
php5:
  Installed: 5.4.45-3+donate.sury.org~precise+3
  Candidate: 5.5.9+dfsg-1ubuntu4.17
  Version table:
     5.5.9+dfsg-1ubuntu4.17 0
        500 http://eu-west-1.ec2.archive.ubuntu.com/ubuntu/ trusty-updates/main amd64 Packages
        500 http://security.ubuntu.com/ubuntu/ trusty-security/main amd64 Packages
     5.5.9+dfsg-1ubuntu4 0
        500 http://eu-west-1.ec2.archive.ubuntu.com/ubuntu/ trusty/main amd64 Packages
 *** 5.4.45-3+donate.sury.org~precise+3 0
        500 http://ppa.launchpad.net/ondrej/php5-oldstable/ubuntu/ precise/main amd64 Packages

[ubuntu@nixmind ~]$ php -v
PHP 5.5.9-1ubuntu4.17 (cli) (built: May 19 2016 19:05:57) 
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies
    with Zend OPcache v7.0.3, Copyright (c) 1999-2014, by Zend Technologies

然后我的问题是:

  • 为什么php -vapt-cache策略输出之间存在差异?

  • 是不是真的可以在ubuntu trusty上安装php5.4?

  • 有一个很好的方法让php5?4在ubuntu上运行可靠而没有这种歧义吗?

问候。

试试Linuxbrew 它可以并排安装两个或更多PHP版本。

它适用于Linux Mint 17.3(基于Ubuntu 14.04),PHP 5.4,5.5,5.6,7.0和7.1。

PHP 5.3虽然不能编译:-(

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM