1.使用pecl,pear工具安裝PHP擴展
pecl install xxxx(擴展名)
2.編譯安裝方式
#php源碼中的ext目錄下含有一些常用的擴展
#舉例安裝一個mysqli擴展
cd /root/php-7.1.9/ext/mysqli
phpize
./configure --with-php-config=/usr/local/php/bin/php-config
make && make install
#tip
#有些擴展會提示 config0.m4 不存在,一般是因爲m4文件命名問題
#如果源碼中沒有你要的擴展,比如redis擴展在ext目錄下不存在,直接使用pecl install安裝,如果pecl安裝失敗,百度一下吧(github)