[总结]在centos环境中安装php的pear和pecl

aries 发表于 2014-04-25 4654 次浏览 标签 : lnmpcentospearphp

参考链接: Linux上安装php的pear

首先下载安装脚本, 使用curl下载, wget也可以, 如果没有这两个命令请自行安装: 
cd /usr/local/php/bin/ 
curl -o go-pear.php http://pear.php.net/go-pear 
curl -o go-pear.php http://pear.php.net/go-pear.phar # 如果你的php版本高于php5.3, 执行这条

安装:

注意,需要开启“shell_exec” 这个函数
php go-pear.php # 回车, 会提示选择安装的东西, 直接回车, 安装全部, 若后面有要选择y/n的, 输入y回车

如果看到下面的一段话就是安装成功:

Run it without parameters to see the available actions, try 'pear list' 
to see what packages are installed, or 'pear help' for help. 

For more information about PEAR, see: 

  http://pear.php.net/faq.php 
  http://pear.php.net/manual/ 

Thanks for using go-pear!

写这个的原因是因为想尝试自己编译php手册, 其中有用到pear.

另外建议把php/bin加入到PATH去, centos下:

vi /etc/profile # 在最后加入如下 
PATH=.:$PATH:/usr/local/php/etc:/usr/local/php/bin 
export PATH

然后利用pear,你就可以安装一些扩展了,比如libevent

/usr/local/php/bin/pecl install channel://pecl.php.net/libevent-0.1.0

再添加 extension=libevent.so 到 php.ini

0条评论

如需评论,请填写表单。
换一个

记住我的信息