安装 Swoole 提示 openssl 相关报错处理

报错

1
2
3
4
5
6
7
8
9
10
11
12
ocal/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -I/usr/local/openssl/include -I/tmp/pear/temp/swoole -I/tmp/pear/temp/swoole/include -I/tmp/pear/temp/swoole/ext-src -I/tmp/pear/temp/swoole/thirdparty/hiredis -DHAVE_CONFIG_H -g -O2 -Wall -Wno-unused-function -Wno-deprecated -Wno-deprecated-declarations -std=c++11 -c /tmp/pear/temp/swoole/ext-src/php_swoole.cc  -fPIC -DPIC -o ext-src/.libs/php_swoole.o
In file included from /tmp/pear/temp/swoole/include/swoole_socket.h:34,
from /tmp/pear/temp/swoole/include/swoole_coroutine.h:22,
from /tmp/pear/temp/swoole/ext-src/php_swoole_coroutine.h:22,
from /tmp/pear/temp/swoole/ext-src/php_swoole_cxx.h:20,
from /tmp/pear/temp/swoole/ext-src/php_swoole.cc:16:
/tmp/pear/temp/swoole/include/swoole_ssl.h:27:10: fatal error: openssl/ssl.h: No such file or directory
#include <openssl/ssl.h>
^~~~~~~~~~~~~~~
compilation terminated.
make: *** [Makefile:192: ext-src/php_swoole.lo] Error 1
ERROR: `make' failed
阅读更多

Swoole 协程的思考-执行顺序

示例

情况一:非阻塞IO

1
2
3
4
5
6
7
8
9
10
11
12
<?php

go(function () {
echo 'AA'.date('Y-m-d H:i:s').PHP_EOL;
Co::sleep(1);
echo 'BBB'.date('Y-m-d H:i:s').PHP_EOL;
});

go(function () {
echo 'CC'.date('Y-m-d H:i:s').PHP_EOL;
echo 'DD'.date('Y-m-d H:i:s').PHP_EOL;
});
阅读更多