詳解php通過pecl方式安裝擴展
1、安裝pecl及創建快捷鍵(若安裝php時已帶可忽略這步安裝步驟)
# cd /usr/local/php/bin/ //可查看是否已帶有pecl
# wget http://pear.php.net/go-pear.phar -O go-pear.php
# php go-pear.php
# ln -s /usr/local/php
/bin/pecl /usr/bin/pecl
2、查詢是否已經收錄了該擴展
# pecl search swoole // swoole為要查詢擴展名(以swoole擴展為例)
//查詢結果:
Retrieving data...0%
.Matched packages, channel pecl.php.net:
=======================================
Package Stable/(Latest) Local
swoole 1.9.23 (stable) Event-driven asynchronous and concurrent networking engine with high performance for PHP.
swoole_serialize 0.1.1 (beta) the fastest and smallest serialize fucntion bound for php7
3、安裝配置擴展
# pecl install swoole
//輸出結果:
Build process completed successfully
Installing '/usr/lib64/php/modules/swoole.so'
install ok: channel://pecl.php.net/swoole-1.9.23
configuration option "php_ini" is not set to php.ini location
You should add "extension=swoole.so" to php.ini
# 配置php.ini引用swoole.so然后重啟php即可
注:相比於phpize方式安裝,pecl方式安裝更為簡便,可省去手動添加到php.ini的環節