Most of the modules in swoole can only be used in the CLI command line environment. Only the swoole_client with synchronization blocking can be used in the php-fpm or apache environment.
Sync swoole_client
$client = new swoole_client(SWOOLE_SOCK_TCP); //同步阻塞 $client->connect('127.0.0.1', 9501) or die("connect failed\n"); $client->send(str_repeat("A", 600)); $data = $client->recv(700, 0) or die("recv failed\n"); echo "recv: " . $data . "\n";
(Recommended learning: swoole video tutorial)
The above is the detailed content of How to run swoole in php-fpm mode. For more information, please follow other related articles on the PHP Chinese website!