Note: Adjust the paths according to your own PHP installation.
php –ri swoole # Check if PHP supports Swoole

cd /usr/local/src
wget https://github.com/swoole/swoole-src/archive/v4.3.1.tar.gz
tar zxvf v4.3.1.tar.gz && cd swoole-src-4.3.1/
/usr/local/php/bin/phpize
./configure –with-php-config=/usr/local/php/bin/php-config –enable-openssl –enable-http2 –enable-sockets –enable-mysqlnd
make && make install
Configure PHP support:
vi /usr/local/php/etc/php.ini # Append the following at the end
[swoole]
extension = "swoole.so"
Restart PHP and query again.