環境:gcc
yum install gccphp
第一步:下載swoole包
wget http://pecl.php.net/package/swoole
第二步:解壓,並進入
執行:/usr/local/php/bin/phpize
可能會報錯
Cannot find autoconf. Please check your autoconf installation and the? $PHP_AUTOCONF? environment
variable is set correctly and then rerun this script.
解決錯誤
yum -y install gcc automake autoconf libtool make(安裝make)
wget http://ftp.gnu.org/gnu/m4/m4-1.4.9.tar.gz
tar -zvxf m4-1.4.9.tar.gz
cd m4-1.4.9/
./configure && make && make install
cd ../
wget http://ftp.gnu.org/gnu/autoconf/autoconf-2.62.tar.gz
tar -zvxf autoconf-2.62.tar.gz
cd autoconf-2.62/
./configure && make && make install
而後繼續執行/usr/local/php/bin/phpize
第三步:執行./configure --with-php-config=/usr/local/php/bin/php-config
可能會報錯
configure: error: C++ preprocessor 「/lib/cpp」 fails sanity
check See `config.log’ for more details
解決辦法:
出現該狀況是因爲c++編譯器的相關package沒有安裝,以root用戶登錄,在終端上執行:
# yum install glibc-headers
# yum install gcc-c++
最後找到php.ini 在裏面找到extension_dir="(複製執行完上一步後Installing shared extensions:顯示的路徑)"; 添加extension=swoole.so