我通过再次安装 pear 对此进行了排序。下载 go-pear.phar 后运行
sudo php -d detect_unicode=0 go-pear.phar
在安装中有一些选项可以更改 pear 正在使用的目录。它们已经为我的新 php 设置到正确的位置,例如 /usr/local/php5/bin
然后我必须将该路径添加到我的 bash_profile 才能识别 pear 命令。
export PATH=$PATH:/usr/local/php5/bin
为了让 pecl 再次工作,我从 /usr/bin 中删除了 pecl,然后符号链接到 /usr/local/php5/bin 中的 pecl
sudo ln -s /usr/local/php5/bin/pecl /usr/bin/pecl
我尝试安装的第一个软件包是 APC,但出现错误
Cannot find autoconf. Please check your autoconf installation and the
$PHP_AUTOCONF environment variable. Then, rerun this script.
ERROR: `phpize' failed
这是按照phpize won't work on Mac OS X Lion 的说明排序的,我使用的是自制解决方案
更新:我很好地安装了 PHPUnit,然后运行 phpunit --version
这给出了一个错误
PHP Warning: require(/usr/lib/php/pear/PHPUnit/Autoload.php): failed to open stream: No such file or directory in /usr/bin/phpunit on line 43
运行which phpunit 返回/usr/bin/phpunit
通过更多符号链接解决
sudo ln -s /usr/local/php5/bin/phpunit phpunit