Home  >  Article  >  PHP Framework  >  How to run swoole in php-fpm mode

How to run swoole in php-fpm mode

尚
Original
2019-12-09 09:35:463494browse

How to run swoole in php-fpm mode

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn