$ pecl -d php_suffix=5.6 install <package>
$ pecl uninstall -r <package>
$ pecl -d php_suffix=7.0 install <package>
$ pecl uninstall -r <package>
$ pecl -d php_suffix=7.1 install <package>
$ pecl uninstall -r <package>
與使用pecl config-set預先設置配置值相比,-d php_suffix=允許您在運行時設置配置值。 uninstall -r位實際上並未從文檔中卸載:
vagrant@homestead:~$ pecl help uninstall
pecl uninstall [options] [channel/]<package> ...
Uninstalls one or more PEAR packages. More than one package may be
specified at once. Prefix with channel name to uninstall from a
channel not in your default channel (pecl.php.net)
Options:
...
-r, --register-only
do not remove files, only register the packages as not installed
...
卸載行是必需的,否則安裝它會刪除任何以前安裝的版本,即使它是用於其他PHP版本的(例如:如果軟件包仍註冊爲已安裝,則安裝PHP 7.0的擴展名也會刪除5.6版本)。