擴展安裝: 參考GitHub地址
安裝:
1. 使用PHP官方的PECL工具安裝 (初學者)
pecl install swoole
2. 從源碼編譯安裝 (推薦)
git clone https://github.com/swoole/swoole-src.git && \
cd swoole-src && \ phpize && \ ./configure && \ make && sudo make install
注意點: 使用源碼進行安裝的時候,遇到的問題總結
1)phpize命令無法找到,使用絕對路徑即可解決
2)./configure 的時候出錯:configure: error: Cannot find php-config. Please use --with-php-config=PATH 指定PHP配置文件目錄即可 ./configure --with-php-config=/usr/local/php/bin/php-config 即可
常用命令:
1. 查看PHP擴展的相關配置
php --ri swoole swoole swoole support => enabled Version => 4.2.10 Author => Swoole Group[email: team@swoole.com] coroutine => enabled epoll => enabled eventfd => enabled signalfd => enabled cpu_affinity => enabled spinlock => enabled rwlock => enabled pcre => enabled zlib => enabled mutex_timedlock => enabled pthread_barrier => enabled futex => enabled async_redis => enabled Directive => Local Value => Master Value swoole.enable_coroutine => On => On swoole.aio_thread_num => 2 => 2 swoole.display_errors => On => On swoole.use_shortname => On => On swoole.fast_serialize => Off => Off swoole.unixsock_buffer_size => 8388608 => 8388608