下载并安装pear脚本
cd /usr/local/php/bin/
curl -o go-pear.php http://pear.php.net/go-pear.phar
./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扩展了
1.打开网页 http://pecl.php.net/packages.php
2.搜索php扩展
3.如果存在(Search results (1 – 1 of 1)), 则记下名字, 例如redis
4.来到linux命令行, 输入: pecl install redis 或 pecl download redis
有时候可能install会失败, 那就只能download源码包到本地自己动手进行编译安装了