php使用pecl方式安装扩展操作示例

这篇文章主要介绍了php使用pecl方式安装扩展操作,结合实例形式分析了pecl的安装、以及基于pecl的扩展查找、安装,并给出了swoole与xdebug扩展安装的操作步骤,需要的朋友可以参考下。

本文实例讲述了php使用pecl方式安装扩展操作,分享给大家供大家参考,具体如下:

安装pecl

  1. cd /usr/local/php/bin/
  2. wget http://pear.php.net/go-pear.phar -O go-pear.php
  3. php go-pear.php
  4. ##回车默认安装

安装php扩展

pecl search key-word #用于查找扩展

pecl install key-word #用于安装扩展

查询相关扩展

  1. [root@localhost src]# pecl search swoole
  2. Retrieving data...0%
  3. Matched packages, channel pecl.php.net:
  4. =======================================
  5. Package Stable/(Latest) Local
  6. swoole 1.8.12 (stable) 1.8.12 Event-driven asynchronous and concurrent networking engine with high performance for PHP.
  7. [root@localhost src]# pecl search xdebug
  8. Retrieving data...0%
  9. Matched packages, channel pecl.php.net:
  10. =======================================
  11. Package Stable/(Latest) Local
  12. xdebug 2.4.1 (stable) Provides functions for function traces and profiling

安装相关扩展

  1. pecl install xdebug
  2. ##安装完成之后,输出
  3. Build process completed successfully
  4. Installing '/usr/lib64/php/modules/xdebug.so'
  5. install ok: channel://pecl.php.net/xdebug-2.4.1
  6. configuration option "php_ini" is not set to php.ini location
  7. You should add "zend_extension=/usr/lib64/php/modules/xdebug.so" to php.ini
  8. ##根据提示,我们在php.ini的最后添加
  9. zend_extension=/usr/lib64/php/modules/xdebug.so
  10. pecl install swoole