php之swoole安装与基本使用

 

扩展安装: 参考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

 






posted @ 2018-12-19 14:43  X-Wolf  阅读(1627)  评论(0编辑  收藏  举报