<p>PECL 的全称是 The PHP Extension Community Library ,是一个开放的并通过 PEAR(PHP Extension and Application Repository,PHP 扩展和应用仓库)打包格式来打包安装的 PHP 扩展库仓库。</p><p>phpize 命令是用来准备 PHP 扩展库的编译环境的,有了这个工具不必为了一个想要的模块,而重新编译php了!</p><p></p><p>例子:为php增加openssl.so模块</p><p>1 使用 phpize</p><p>cd php-5.2.6/ext/openssl/</p><p></p><p>/usr/local/php/bin/phpize</p><p>Configuring for:</p><p>PHP Api Version: 20041225</p><p>Zend Module Api No: 20060613</p><p>Zend Extension Api No: 220060519</p><p></p><p>./configure --with-openssl --with-php-config=/usr/local/php/bin/php-config</p><p>make && make install</p><p>installing shared extensions: /usr/local/php/lib/php/extensions/no-debug-non-zts-20060613/</p><p>2 得到openssl.so 文件</p><p>file /usr/local/php/lib/php/extensions/no-debug-non-zts-20060613/openssl.so </p><p>/usr/.省略./openssl.so: ELF 64-bit LSB shared object, AMD x86-64, version 1 (SYSV), not stripped</p><p>3 编辑php.in配置文档</p><p>在php.ini内加入以下内容:</p><p>extension_dir = "/usr/local/php/lib/php/extensions/no-debug-non-zts-20060613/"</p><p>extension = "openssl.so"</p><p>4 重启apache</p><p>/usr/local/apache/bin/apachectl restart</p><p>5 验证</p><p># /usr/local/php/bin/php -m | grep 'openssl'</p><p>openssl</p><p></p><p>#update 20130216 pdo-mysql</p><p>./configure --with-pdo-mysql=/usr/local/mysql/ --with-php-config=/usr/local/php/bin/php-config</p><p></p><p>/usr/local/src/php5.3.23/ext/$mkdir redis & cd redis</p><p>/usr/local/src/php5.3.23/ext/redis/$/usr/local/php/bin/phpize --with-php-config=/usr/local/php/bin/php-config</p><p>/usr/local/src/php5.3.23/ext/redis/$make & make install</p><p>修改php.ini添加</p><p>extension=redis.so</p><p>参考</p><p>http://www.php.net/manual/zh/install.pecl.intro.php</p><p>http://www.ibm.com/developerworks/cn/opensource/os-cn-php-pecl/index.html</p><p>结束</p>