[Original article from 51CTO.com] In the face of some business scenarios that are not responsive and time-consuming, in addition to using multi-threading or multi-process methods to handle them to improve the response speed of the program, as message queues become more and more mature, advanced message queues based on RabbitMQ are gradually entering the world of our programmers. It can also handle these scenarios. Today we will talk about the PHP version of RabbitMQ. Local system environment PHP: PHP 7.1.2 Web server: Apache Database: MySQL Operating system: Win7 64 bit Install RabbitMQ server Since RabbitMQ is based on Erlang, the first step is to install it. The current OS is Win7, so open the official website of Erlang, find the version corresponding to the operating system, download and install it. Since it is an exe file, we can directly click Next, Next, etc. to complete the installation of Erlang. Next, install RabbitMQ. Open its official website and you can see that the software provides various operating system versions. We just need to select the corresponding version to download and install it. This is an exe file, so just click Next and then Next to complete it. Install PHP RabbitMQ extension First, open the PECL website, the official extension library of PHP, and find the AMQP (Advanced Message Queuing Protocol) extension. Why? Because the AMQP extension is a service program that can communicate with all AMQP-compatible programs, and RabbitMQ is an AMQP-compatible protocol. When we open AMQP, we can see that it has a Windows extension (dll), but when we download it, we find that there are many versions, namely thread-safe and non-thread-safe, 64-bit and 32-bit versions. What should we do at this time? I don't know if you have the experience of downloading PHP from the official PHP website and installing it. In fact, when you download PHP from the official website, there are thread safety and non-thread safety mentioned above. In other words, the corresponding PECL extension must correspond to your PHP version, otherwise, your extension will report an error and cannot be used. So we can use phpinfo to see the status of our current PHP version, and find the corresponding information to know which version of the extension to download. I originally thought that I had completely installed this extension, but when I restarted the WEB server, I found a fatal problem, that is, the WEB server could not start normally, so I started various explorations, and finally found that the rabbitmq.4.dll file needs to be placed in the root directory of the PHP installation, that is, in the Windows environment, and this file needs to be copied to the same directory as php.ini. This file comes from the decompression of the above extension. At this point, the PHP version of the RabbitMQ development environment has been completely built. The next exciting thing is to start my MQ development practice journey. Some basic concepts
Conduct a PHP version Demo Consumer side: server.php Producer side: client.php Start the RabbitMQ service and view the log Looking at the log above, the relevant data has been saved in the file, successfully completing my first RabbitMQ journey. Welcome to leave comments, or join the Q group for discussion (group number 542270018) [51CTO original article, please indicate the original author and source as 51CTO.com when reprinting on partner sites] |
<<: Exploring the PHP kernel: PHP's FastCGI
>>: A step-by-step guide to spam filtering with Python and Scikit-Learn
Those who follow WeChat Mini Programs may know th...
This article mainly conducts a detailed analysis ...
Perception is greater than fact, which is a topic...
The "2018 Douyin Big Data Report" relea...
Attracting new users , promoting activation, and ...
Wall Street Academy Excel Financial Business Char...
As market competition becomes increasingly fierce...
"Traffic is the prerequisite for promotion&q...
There is a famous saying in martial arts novels: ...
Behind the popularity of grass-roots marketing is...
I have been busy at work recently, so I reposted ...
Yifan will help you master mind mapping and devel...
Contents: Bai Ya was deflowered by a mysterious m...
[[162446]] CEO Zhang Yong said at the Global B2B ...
Traffic generation is a difficult problem for alm...