[英]Mountain Lion php pear and pecl
I've upgraded to Mountain Lion and installed php5.4 which took a bit of tweaking Mountain Lion change php location 我升级到Mountain Lion并安装了php5.4,这需要一些调整Mountain Lion更改php位置
My next issue is if I run pear -v
or pecl -v
these return 我的下一个问题是如果我运行
pear -v
或pecl -v
这些返回
Could not open input file: /usr/lib/php/pear/pearcmd.php
Could not open input file: /usr/lib/php/pear/peclcmd.php
Do I need to change pear and pecl to point to my new php which is installed in /usr/local/php5/bin/ 我是否需要更改pear和pecl以指向安装在/ usr / local / php5 / bin /中的新php
If so how do I do this and will I lose all of my previously installed extensions such as phpunit? 如果是这样,我该如何做,我将丢失所有以前安装的扩展程序,如phpunit?
Thanks 谢谢
I sorted this by installing pear again. 我通过再次安装梨来分类。 After downloading go-pear.phar then running
下载go-pear.phar然后运行
sudo php -d detect_unicode=0 go-pear.phar
In the install there are options to change directories pear is using. 在安装中,有一些选项可以更改pear正在使用的目录。 They were already set to the correct locations for my new php such as /usr/local/php5/bin
他们已经设置到我的新PHP的正确位置,如/ usr / local / php5 / bin
I then had to add that path to my bash_profile for the pear command to be recognised. 然后,我必须将该路径添加到我的bash_profile中,以便识别pear命令。
export PATH=$PATH:/usr/local/php5/bin
To get pecl working again I removed pecl from /usr/bin then symlinked to the pecl in /usr/local/php5/bin 为了让pecl再次工作,我从/ usr / bin中删除了pecl,然后符号链接到/ usr / local / php5 / bin中的pecl
sudo ln -s /usr/local/php5/bin/pecl /usr/bin/pecl
The first package I tried to install was APC and I got the error 我试图安装的第一个包是APC,我收到了错误
Cannot find autoconf. Please check your autoconf installation and the
$PHP_AUTOCONF environment variable. Then, rerun this script.
ERROR: `phpize' failed
This was sorted by following instructions from phpize won't work on Mac OS X Lion I used the homebrew solution 这是根据phpize的以下说明排序将无法在Mac OS X Lion上使用我使用自制程序解决方案
UPDATE: I installed PHPUnit fine then ran phpunit --version
更新:我安装PHPUnit然后运行
phpunit --version
This gave an error of 这给出了错误
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
Running which phpunit
returned /usr/bin/phpunit
运行
which phpunit
返回/usr/bin/phpunit
Solved by more symlinking 通过更多的符号解决
sudo ln -s /usr/local/php5/bin/phpunit phpunit
On Mavericks there's a file in /usr/lib/php
called install-pear-nozlib.phar
在Mavericks上,
/usr/lib/php
名为install-pear-nozlib.phar
Everything worked by just running sudo php install-pear-nozlib.phar
from that directory. 所有工作只需从该目录运行
sudo php install-pear-nozlib.phar
。 And then adding /usr/lib/php/pear
to the include path in php.ini 然后将
/usr/lib/php/pear
到php.ini中的include路径
Hope that helps someone 希望能帮助别人
I have this issue with one of my users on my Mac. 我在Mac上的一个用户遇到此问题。 It works fine with the other.
它与另一个一起工作正常。 So I guess it could have something to do with installing pear using the other user (as that's what I did).
所以我想这可能与使用其他用户安装pear有关(就像我做的那样)。
I have no solution to this, but you could try to install pear again and try to select to install it to system instead of local and see if that works. 我没有解决方案,但您可以尝试再次安装pear并尝试选择将其安装到系统而不是本地,并查看是否有效。
Edit: I tried to do this, however pear started to work, but not pecl. 编辑:我试图这样做,但梨开始工作,但不是pecl。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.