我想在我的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
然后我手动添加精确的回购:
[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 -v 与 apt-cache政策之间存在差异? 输出
实际上是不是可以在ubuntu trusty上安装php5.4吗?
如果没有这个,可以在ubuntu上运行php5?4的好方法 模糊?
问候。
答案 0 :(得分:0)
试试Linuxbrew。它可以并排安装两个或更多PHP版本。
它适用于Linux Mint 17.3(基于Ubuntu 14.04),PHP 5.4,5.5,5.6,7.0和7.1。
PHP 5.3无法编译: - (