如何修复 swoole_version not found with docker.io/openswoole/swoole:php7.4-alpine,即使 openswool.so 已加载

问题描述 投票:0回答:0

我正在尝试使用 docker 图像

docker.io/openswoole/swoole:php7.4-alpine
向 openswole http 服务器发送文本,但是,我什至找不到函数
swoole_version()
,我已经检查了 php --ri openswole,库在那里。这是输出

openswoole

openswoole

Open Swoole => enabled
Author => Open Swoole Group <[email protected]>
Version => 22.0.0
Built => Mar 13 2023 02:04:41
coroutine => enabled with boost asm context
epoll => enabled
eventfd => enabled
signalfd => enabled
spinlock => enabled
rwlock => enabled
sockets => enabled
openssl => OpenSSL 1.1.1t  7 Feb 2023
dtls => enabled
http2 => enabled
hook-curl => enabled
pcre => enabled
zlib => 1.2.12
brotli => E16777225/D16777225
mutex_timedlock => enabled
pthread_barrier => enabled
futex => enabled
mysqlnd => enabled
postgresql => enabled

Directive => Local Value => Master Value
openswoole.enable_coroutine => On => On
openswoole.enable_preemptive_scheduler => Off => Off
openswoole.display_errors => On => On
openswoole.unixsock_buffer_size => 8388608 => 8388608

我尝试搜索 google/搜索引擎和 git repo,似乎它们只指向未加载的 lib 或 .so 文件,但在我的情况下它在那里。第二次尝试是检查注册的功能似乎只有一些 openswole 功能在那里。

我尝试使用此代码进行检查

<?php 

$function = get_defined_functions()["internal"];

$result = array_filter($function, function($d) { return strpos($d, "swoole") !== false; });

var_dump($result);

输出为

array(23) {
  [1227]=>
  string(23) "swoole_coroutine_create"
  [1228]=>
  string(22) "swoole_coroutine_defer"
  [1229]=>
  string(27) "swoole_coroutine_socketpair"
  [1230]=>
  string(28) "swoole_test_kernel_coroutine"
  [1231]=>
  string(40) "swoole_internal_call_user_shutdown_begin"
  [1234]=>
  string(16) "swoole_event_add"
  [1235]=>
  string(16) "swoole_event_del"
  [1236]=>
  string(16) "swoole_event_set"
  [1237]=>
  string(18) "swoole_event_isset"
  [1238]=>
  string(21) "swoole_event_dispatch"
  [1239]=>
  string(18) "swoole_event_defer"
  [1240]=>
  string(18) "swoole_event_cycle"
  [1241]=>
  string(18) "swoole_event_write"
  [1242]=>
  string(17) "swoole_event_wait"
  [1243]=>
  string(17) "swoole_event_exit"
  [1244]=>
  string(18) "swoole_timer_after"
  [1245]=>
  string(17) "swoole_timer_tick"
  [1246]=>
  string(19) "swoole_timer_exists"
  [1247]=>
  string(17) "swoole_timer_info"
  [1248]=>
  string(18) "swoole_timer_stats"
  [1249]=>
  string(17) "swoole_timer_list"
  [1250]=>
  string(18) "swoole_timer_clear"
  [1251]=>
  string(22) "swoole_timer_clear_all"
}

基于 PHP.net 文档(https://www.php.net/manual/en/ref.swoole-funcs.php),应该有一个函数叫做 swoole_version,但似乎是官方的 docker 镜像和 openswole .so 没有它。

是设计的吗?或者我需要付费才能使用它?或者我需要启用一些配置?

非常感谢任何指针。谢谢

php docker shared-libraries openswoole
© www.soinside.com 2019 - 2024. All rights reserved.