*INSTALL SWOOLE *
apt install php-dev libc-ares-dev libcurl4-openssl-dev
sudo pecl install -D 'enable-sockets="yes" enable-openssl="yes" enable-http2="yes" enable-mysqlnd="yes" enable-swoole-json="yes" enable-swoole-curl="yes" enable-cares="yes"' swoole
echo "extension=swoole.so" > /etc/php/8.1/cli/conf.d/20-swoole.ini
CHECK SWOOLE EXTENSION LOADED
php -m | grep swoole
php --ri swoole
TEST SWOOLE
<?php
$http = new Swoole\Http\Server('0.0.0.0', 9501);
$http->on("request", function ($request, $response) {
$response->header("Content-Type", "text/plain");
$response->end("Hello, Swoole!");
});
$http->start();
?>
curl localhost:9501
Top comments (0)