pecl为先前的php版本安装

pecl为先前的php版本安装

本文介绍了pecl为先前的php版本安装的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经将MacBook升级到Mavericks,并且破坏了我的开发环境.我现在遇到的问题是我的pear/pecl仍尝试为以前的(5.3)PHP版本而不是5.4版本安装.

I've upgraded my MacBook to Mavericks and ruined my development environment. The problem I have right now is that my pear/pecl still tries to install for my previous (5.3) version of PHP instead of version 5.4.

PHP版本:

$ php -v
PHP 5.4.17 (cli) (built: Aug 25 2013 02:03:38)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies
    with Xdebug v2.2.3, Copyright (c) 2002-2013, by Derick Rethans

$ pear version
PEAR Version: 1.9.4
PHP Version: 5.4.17
Zend Engine Version: 2.4.0
Running on: Darwin MBP-retina.local 13.0.0 Darwin Kernel Version 13.0.0: Thu Sep 19 22:22:27 PDT2013; root:xnu-2422.1.72~6/RELEASE_X86_64 x86_64

如果我使用以下方式安装apc

If I install apc with

$ sudo pecl install apc
downloading APC-3.1.13.tgz ...
Starting to download APC-3.1.13.tgz (171,591 bytes)
.....................................done: 171,591 bytes
55 source files, building
running: phpize
Configuring for:
PHP Api Version:         20090626
Zend Module Api No:      20090626
Zend Extension Api No:   220090626
...
Build process completed successfully
Installing '/usr/local/Cellar/php53/5.3.26/include/php/ext/apc/apc_serializer.h'
Installing '/usr/local/Cellar/php53/5.3.26/lib/php/extensions/no-debug-non-zts-20090626/apc.so'
install ok: channel://pecl.php.net/APC-3.1.13
Extension apc enabled in php.ini

并在我的php.ini php -v中启用apc模块,将其更改为:

And enable the apc module in my php.ini php -v changes to this:

$ php -v
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php/extensions/no-debug-non-zts-20100525/apc.so' - dlopen(/usr/lib/php/extensions/no-debug-non-zts-20100525/apc.so, 9): image not found in Unknown on line 0
PHP 5.4.17 (cli) (built: Aug 25 2013 02:03:38)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies
    with Xdebug v2.2.3, Copyright (c) 2002-2013, by Derick Rethans

因此pecl将我的apc扩展名安装在/usr/local/Cellar/php53/5.3.26/lib/php/extensions/no-debug-non-zts-20090626中,而php希望在/usr/lib/php/extensions/no-debug-non-zts-20100525/中安装它.

So pecl installs my apc extension in /usr/local/Cellar/php53/5.3.26/lib/php/extensions/no-debug-non-zts-20090626 and php expects it in /usr/lib/php/extensions/no-debug-non-zts-20100525/.

简单地建立符号链接会产生以下错误:

Simply making a symlink gives the following error:

$ php -v
PHP Warning:  PHP Startup: apc: Unable to initialize module
Module compiled with module API=20090626
PHP    compiled with module API=20100525
These options need to match
 in Unknown on line 0
PHP 5.4.17 (cli) (built: Aug 25 2013 02:03:38)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies
    with Xdebug v2.2.3, Copyright (c) 2002-2013, by Derick Rethans

所以这不是解决方案.

有人能指出我正确的方向吗?我真的不知道这是怎么回事.

Can anybody point me in the right direction? I really don't have a clue what is going on here.

推荐答案

解决方案非常简单.我必须对我的pecl配置进行修改.原来,这两个命令可以解决问题:

The solution was pretty simple. I had to make modifications to my pecl config. It turned out that these two command did the trick:

sudo pear config-set php_ini /etc/php.ini
sudo pecl config-set bin_dir /usr/bin/

pecl使用了错误的phpize. phpize有两个版本.对于我的php.ini文件也是如此.

pecl used the wrong phpize. There were two versions of the phpize. The same counts for my php.ini file.

这篇关于pecl为先前的php版本安装的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-28 19:22