Upgrading PHP pear and pecl


Upgrading PHP pear and pecl

我正在使用Amazon Linux AMI。我已经安装了PHP5.4 .

php -v

PHP 5.4.13 (cli) (built: Mar 29 2013 20:29:42) 
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies

当我做pear -V

PEAR Version: 1.10.1
PHP Version: 5.3.29
Zend Engine Version: 2.3.0
Running on: Linux ip-10-0-1-160 4.1.7-15.23.amzn1.x86_64 #1 SMP Mon Sep 14 23:20:33 UTC 2015 x86_64

pecl -V给出

PEAR Version: 1.10.1
PHP Version: 5.3.29
Zend Engine Version: 2.3.0
Running on: Linux ip-10-0-1-160 4.1.7-15.23.amzn1.x86_64 #1 SMP Mon Sep 14 23:20:33 UTC 2015 x86_64

我的问题是pearpecl命令中显示的PHP版本与php -v不同

当我使用pecl <module>安装另一个模块时,它给出

Warning: PHP Startup: <module>: Unable to initialize module
Module compiled with module API=20090626
PHP    compiled with module API=20100525
<标题>编辑

我发现有两个php安装

/usr/bin/php -v给出

PHP 5.3.29 (cli) (built: May 12 2015 22:42:19) 
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2014 Zend Technologies

/usr/local/bin/php -v给出

PHP 5.4.13 (cli) (built: Mar 29 2013 20:29:42) 
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies

我想使用PHP 5.4版本,并使用pear和pecl安装模块。我该怎么做呢?

您应该能够通过告诉PEAR使用PHP 5.4版本来完成此操作…也许可以试试这个:

首先,记下所有当前设置,以防需要回滚:

pear config-show

一旦你把这些信息复制并保存到某个地方,进行修改:

pear config-set php_bin /usr/local/bin/php

在您的.bashrc中(如果不使用bash,则为等效),您需要将一个名为PHP_PEAR_PHP_BIN的环境变量设置为您想要使用的php二进制文件的位置:

export PHP_PEAR_PHP_BIN=/usr/local/bin/php

我最终使用yum删除pear

sudo yum -y remove php-pear

我这样安装了pear

wget http://pear.php.net/go-pear.phar
/usr/local/bin/php -q php-phar

现在pear -V显示

PEAR Version: 1.10.1
PHP Version: 5.4.13