The swoole-1.8.0+ version adds support for asynchronous Redis clients based on Redis's official Hiredis library implementations. Swoole provides a __call magic method to map most Redis instructions (this installation instance is swoole1.8.10 version)
Compile installation Hiredis (swoole1.8.10 version asynchronous Redis support must be environmental conditions)
Using the Redis client, you need to install the Hiredis library. After downloading the Hiredis source code, executes
Make-j
sudo make install
sudo ldconfig (remember to execute the command when compiling the installation, or PHP will have a red font part error when introducing the Swoole extension)
PHP message:php warning:php startup:unable to load dynamic library '/usr/local/php/lib/php/extensions/no-debug-non-zts -20121212/swoole.so '-Libhiredis.so.0.13:cannot open Shared object file:no such file or directory in Unknown on line 0
HiredisDownload Address:
Https://github.com/redis/hiredis(https://github.com/redis/hiredis/releases)
Enable Asynchronous Redis Client
Compile Swoole Yes, add in configure instructions
--enable-async-redis
./configure--enable-async-redis
Make clean
Make-j
sudo make install
Because there are more extensions for Swoole (SSL, Debug, and so on), the actual compilation commands for picking up heavenly stars are as follows:
./configure--enable-async-redis--with-php-config=/usr/local/php/bin/php-config--enable-openssl-- Enable-swoole-debug--enable-sockets--enable-ringbuffer--enable-swoole
Swoole./configure has a number of additional parameters that can be viewed through the./configure--help command, where the default items are selected)
When the installation is complete, enter the/USR/LOCAL/PHP/ETC directory and open the php.ini file, adding the following sentence:
Extension=swoole.so
Then enter the command php-m in the terminal to view the extended installation (or view it through the phpinfo () function). If you see Swoole in the listed extensions, the installation is successful.