Project-A

Hi,WTF?

  1. 1. 1.安装编译
  2. 2. 2.写入 php 配置文件
  3. 3. 3.重载 php
  4. 4. 4.检测

1.安装编译

1
2
3
4
5
6
7
8
brew install php 
cd /usr/local/opt/
git clone https://gitee.com/swoole/swoole.git
cd swoole
phpize
./configure
brew install autoconf
make && make install

编译完成的.so文件在modules/ 目录下面

2.写入 php 配置文件

1
2
cd /usr/local/etc/php/7.2/conf.d/
touch ext-swoole.ini

写入

1
2
[swoole]
extension="/usr/local/opt/swoole/modules/swoole.so"

重载 php

3.重载 php

1
brew service restart php

4.检测

检测是否加入扩展

1
php -i |grep swoole

如下输出

1
2
3
4
5
6
7
8
9
10
11
12
13
14
/usr/local/etc/php/7.2/conf.d/ext-swoole.ini,
swoole
swoole support => enabled
Author => Swoole Group[email: [email protected]]
swoole.aio_thread_num => 2 => 2
swoole.display_errors => On => On
swoole.enable_coroutine => On => On
swoole.fast_serialize => Off => Off
swoole.unixsock_buffer_size => 262144 => 262144
swoole.use_shortname => On => On
PWD => /usr/local/opt/swoole/modules
OLDPWD => /usr/local/opt/swoole
$_SERVER['PWD'] => /usr/local/opt/swoole/modules
$_SERVER['OLDPWD'] => /usr/local/opt/swoole

则为编译成功

编译成功

This article was last updated on days ago, and the information described in the article may have changed.