通過pecl方式安裝php擴展

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的環節
文章爲個人記錄,如有不足之處,請指出。

 

 

 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章