mac 安装 pecl pear

张映 发表于 2018-11-29

分类目录: php

标签:, ,

php54版没装libevent,发现brew源里面没有,通过pecl安装,发现pecl没有。

1,安装pecl,pear

# sudo mkdir /opt/pecl
# cd /opt/pecl/
# curl -o go-pear.php http://pear.php.net/go-pear.phar
# sudo php go-pear.php 

Below is a suggested file layout for your new PEAR installation. To
change individual locations, type the number in front of the
directory. Type 'all' to change all of them or simply press Enter to
accept these locations.

 1. Installation base ($prefix) : /usr/local/Cellar/php54/5.4.45_7
 2. Temporary directory for processing : /tmp/pear/install
 3. Temporary directory for downloads : /tmp/pear/install
 4. Binaries directory : /usr/local/Cellar/php54/5.4.45_7/bin
 5. PHP code directory ($php_dir) : /usr/local/Cellar/php54/5.4.45_7/share/pear
 6. Documentation directory : /usr/local/Cellar/php54/5.4.45_7/docs
 7. Data directory : /usr/local/Cellar/php54/5.4.45_7/data
 8. User-modifiable configuration files directory : /usr/local/Cellar/php54/5.4.45_7/cfg
 9. Public Web Files directory : /usr/local/Cellar/php54/5.4.45_7/www
10. System manual pages directory : /usr/local/Cellar/php54/5.4.45_7/man
11. Tests directory : /usr/local/Cellar/php54/5.4.45_7/tests
12. Name of configuration file : /usr/local/etc/php/5.4/pear.conf

1-12, 'all' or Enter to continue: 1
(Use $prefix as a shortcut for '/usr/local/Cellar/php54/5.4.45_7', etc.)
Installation base ($prefix) [/usr/local/Cellar/php54/5.4.45_7] : 

过程如下:
1,输入1,回车
2,输入1,回车,输入/usr/local/pear,和上面一次不同
3,输入4,回车,输入/usr/local/bin
4,回车

$ which pecl //成功
/usr/local/bin/pecl

pecl和pear是一起绑定安装的,pear的配置也不用手动去加,会自动的加到php.ini里面去。

2,安装libevent

$ pecl install libevent //报错了
Failed to download pecl/libevent within preferred state "stable", latest release is version 0.1.0, stability "beta", use "channel://pecl.php.net/libevent-0.1.0" to install
install failed

$ pecl install channel://pecl.php.net/libevent-0.1.0 //安装,还是报错
WARNING: channel "pecl.php.net" has updated its protocols, use "pecl channel-update pecl.php.net" to update
Cannot install, php_dir for channel "pecl.php.net" is not writeable by the current user

$ sudo pecl channel-update pecl.php.net //更新
Updating channel "pecl.php.net"
Update of Channel "pecl.php.net" succeeded

$ pecl install channel://pecl.php.net/libevent-0.1.0 //在安装

修改php.ini加上extension=libevent.so,就重启一下ok了。



转载请注明
作者:海底苍鹰
地址:http://blog.51yip.com/php/1983.html

留下评论

留下评论
  • (必需)
  • (必需) (will not be published)
  • (必需)   8X6=?