Home  >  Article  >  PHP Framework  >  How to call swoole in php

How to call swoole in php

(*-*)浩
(*-*)浩Original
2019-12-12 11:04:222805browse

How to call swoole in php

PHP is used in the project, but due to the long and time-consuming task, after the front-end is submitted, the server needs to respond asynchronously.

There are many solutions for server asynchronous, including MQ, fsocket, Swoole, etc.                                                                                                                                             (Recommended learning: swoole video tutorial )

Swoole is written in pure C language and provides an asynchronous multi-threaded server in PHP language, asynchronous TCP/UDP network client, and asynchronous MySQL , asynchronous Redis, database connection pool, AsyncTask, message queue, millisecond timer, asynchronous file reading and writing, asynchronous DNS query.

Swoole has built-in Http/WebSocket server/client and Http2.0 server.

The most important thing is that it perfectly supports the PHP language. So I used Swoole to build an asynchronous server to provide a series of tasks such as asynchronous response, push, and scheduled tasks.

Swoole is written in C language and is compiled and installed.

The installation dependencies are:

php-5.3.10 或更高版本
gcc-4.4 或更高版本
make
autoconf
pcre (centos系统可以执行命令:yum install pcre-devel)

Installation method:

phpize #If the command does not exist, please Add the actual path of php in front

./configure
make 
sudo make install

After the compilation is completed, you need to add the extension

extension=swoole.so
in php.ini

The above is the detailed content of How to call swoole in php. 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