Home >Backend Development >PHP Tutorial >php zmq extension
First of all, let’s talk about ZMQ, which is the abbreviation of zeromq
What is ZMQ?
This is a series of interfaces similar to Socket. The difference between it and Socket is: ordinary socket is end-to-end (1:1 relationship), but ZMQ can have N:M relationship. People are familiar with BSD sockets. What I know more about is point-to-point connections. Point-to-point connections require explicitly establishing connections, destroying connections, selecting protocols (TCP/UDP), and handling errors, etc. ZMQ shields these details, making your network programming simpler. ZMQ is used for communication between nodes. A node can be a host or a process.
Quoting the official statement: "ZMQ (hereinafter ZeroMQ is referred to as ZMQ) is a simple and easy-to-use transport layer, a socket library like a framework. It makes Socket programming simpler, more concise and more performant. It is a message processing queue library , elastically scalable across multiple threads, cores, and host boxes. The stated goal of ZMQ is to "become part of the standard network protocol stack and later enter the Linux kernel." However, it certainly is. A promising and much needed wrapper over "traditional" BSD sockets, ZMQ makes writing high-performance network applications extremely easy and fun." 1. Install zeromq
1. wget 'http://download.zeromq.org/zeromq-3.2.1-rc2.tar.gz'
2. tar zxvf zeromq-3.2.1-rc2.tar.gz
3. cd zeromq-3.2.1
4. ./configure --prefix=/usr/local/zeromq
5. make
6. make install
2. Install php extension
1. wget 'https://github.com/mkoppanen/php-zmq/zipball/master'
2. unzip mkoppanen-php-zmq-1.0.3-16-g2bfa4c8.zip
3. cd mkoppanen-php-zmq-2bfa4c8
4. /usr/local/php/bin/phpize
5. ./configure --with-php-c/local/php/bin/php-config --with-zmq=/usr/local/zeromq
6. make
7. make install
8. vi /usr/local/php/etc/php.ini
extension=zmq. so
The above introduces the php zmq extension, including the relevant content. I hope it will be helpful to friends who are interested in PHP tutorials.