我目前在Ubuntu 12.04上安装了2个版本的php。
一个用于使用apt-get安装的php 5.3,另一个用于xampp与php 5.5一起安装
当我执行这些命令时:
> which php
/usr/bin/php
> php --version
PHP 5.3.10-1ubuntu3.8 with Suhosin-Patch (cli) (built: Sep 4 2013 20:05:42)
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies
with Xdebug v2.2.3, Copyright (c) 2002-2013, by Derick Rethan
>echo $PATH
/home/chanhxc/bin
/usr/lib/lightdm/lightdm
/usr/local/sbin
/usr/local/bin
/usr/sbin
/usr/bin
/sbin
/bin
/usr/games
/opt/lampp/bin
/home/chanhxc/pear/bin
/home/chanhxc/.composer/vendor/bin
/opt/lampp/bin
/home/chanhxc/bin
/usr/lib/lightdm/lightdm
/usr/local/sbin
/usr/local/bin
/usr/sbin
/usr/bin
/sbin
/bin
/usr/games
/home/chanhxc/bin
/usr/lib/lightdm/lightdm
/usr/local/sbin
/usr/local/bin
/usr/sbin
/usr/bin
/sbin
/bin
/usr/games
/opt/lampp/bin
/home/chanhxc/pear/bin
/home/chanhxc/.composer/vendor/bin
/opt/lampp/bin
我如何使php 5.5成为要运行的默认版本?
顺便说一句,我的默认外壳是zsh。这是我的.zshrc中的行
export PATH=$PATH:/home/chanhxc/bin:/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
# xampp, pear, composer
export PATH=$PATH:/opt/lampp/bin:/home/chanhxc/pear/bin:/home/chanhxc/.composer/vendor/bin:/opt/lampp/bin
更新资料
如果我选择update-alternatives选项。这是我目前拥有的。
>update-alternatives --query php
Link: php
Status: auto
Best: /usr/bin/php5
Value: /usr/bin/php5
Alternative: /usr/bin/php5
Priority: 50
Slaves:
php.1.gz /usr/share/man/man1/php5.1.gz