openswoole / docker-openswoole

Docker image for Open Swoole
https://hub.docker.com/r/openswoole/swoole
Apache License 2.0
42 stars 5 forks source link

[Question] using docker.io/openswoole/swoole:php7.4-alpine, but can't find swoole_version() #37

Closed benyaminl closed 1 year ago

benyaminl commented 1 year ago

Hello, I want to ask, does the docker swoole, isn't a full blown swoole? I tried to call swoole_version, but seems I can't. I check the function that registers using

<?php 

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

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

var_dump($result);

The output is

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"
}

Is it by design that some of the function isn't available (based on https://www.php.net/manual/en/ref.swoole-funcs.php)? What should I do to make swoole_version available inside the container? Thanks

doubaokun commented 1 year ago

Please use https://openswoole.com/docs/modules/swoole-util-get-version