ext-async
ext-async copied to clipboard
extension installed but extension not detected with error PHP Fatal error: Swoole\Client::__construct(): please install the ext-async extension, using Swoole\Async\Client
extension swoole and swoole_async
the php code
<?php
class TcpDemo
{
public function launch()
{
$client = new Swoole\Client(SWOOLE_SOCK_TCP, SWOOLE_SOCK_ASYNC);
$client->on("connect", function (Swoole\Client $cli) {
$cli->send("hello world\n");
});
$client->on("receive", function (Swoole\Client $cli, $data) {
echo "Receive: $data";
$cli->send(str_repeat('A', 10) . "\n");
});
$client->on("error", function (Swoole\Client $cli) {
echo "error\n";
});
$client->on("close", function (Swoole\Client $cli) {
echo "Connection close\n";
});
$client->connect('127.0.0.1', 80);
}
}
$tcp = new TcpDemo();
$tcp->launch();
run the code then got error
// run
php tcp_client.php
// got fatal error
PHP Fatal error: Swoole\Client::__construct(): please install the ext-async extension, using Swoole\Async\Client in
extension infomation
➜ download php --ri swoole
swoole
Swoole => enabled
Author => Swoole Team <[email protected]>
Version => 4.4.16
Built => Mar 10 2020 18:52:37
coroutine => enabled
epoll => enabled
eventfd => enabled
signalfd => enabled
cpu_affinity => enabled
spinlock => enabled
rwlock => enabled
pcre => enabled
mutex_timedlock => enabled
pthread_barrier => enabled
futex => enabled
async_redis => enabled
Directive => Local Value => Master Value
swoole.enable_coroutine => On => On
swoole.enable_library => On => On
swoole.enable_preemptive_scheduler => Off => Off
swoole.display_errors => On => On
swoole.use_shortname => On => On
swoole.unixsock_buffer_size => 8388608 => 8388608
➜ download php --ri swoole_async
swoole_async
Swoole => enabled
Author => Swoole Team <[email protected]>
Version => 4.4.16
Built => Mar 11 2020 11:02:27
debug => enabled
trace_log => enabled
mysqlnd => enabled
async_redis => enabled