PHP + spool + redis source code compilation and installation

Time:2021-5-8

1. Download PHP source packagehttp://php.net/get/php-7.2.4….

tar -zxvf php-7.2.4.tar.gz
cd php-7.2.4
./configure --prefix=/usr/local/php
make && make install

2. Download swoole source package

git clone https://gitee.com/swoole/swoole.git 
cd swoole
/usr/local/php/bin/phpize
./configure --with-php-config=/usr/local/php/bin/php-config
make && make install

Finally, add extension = spool to php.ini, PHP – M view the extension, and if spool appears, the installation is successful

3. Install redishttps://redis.io/download

tar -zxvf redis-4.0.9.tar.gz
mv redis-4.0.9 /usr/local/redis-4.0.9
cd /usr/local/redis-4.0.9
make

4. Install hirredis (for supporting asynchronous redis clients)https://github.com/redis/hire…

make && make install
ldconfig

5. Recompile spool

./configure --with-php-config=/usr/local/php/bin/php-config --enable-async-redis
make clean
make && make install

PS: there may be a warning when using the PHP – M command to detect installed extensions
PHP Warning: PHP Startup: Unable to load dynamic library ‘swoole’ (tried: /usr/local/php/lib/php/extensions/no-debug-non-zts-20170718/swoole (/usr/local/php/lib/php/extensions/no-debug-non-zts-20170718/swoole: cannot open shared object file: No such file or directory), /usr/local/php/lib/php/extensions/no-debug-non-zts-20170718/swoole.so (libhiredis.so.0.13: cannot open shared object file: No such file or directory)) in Unknown on line 0

Solution:

vi ~/.bash_profile

Add on the last line
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
PHP + spool + redis source code compilation and installation

source ~/.bash_profile

6. Installing synchronous PHP redis extension

git clone https://github.com/phpredis/phpredis.git
cd phpredis
/usr/local/php/bin/phpize
./configure --with-php-config=/usr/local/php/bin/php-config
make && make install

Finally, add extension = redis to php.ini, PHP – M view the extension, and if redis appears, the installation is successful

Recommended Today

Big factories are also using six kinds of data desensitization schemes to strictly prevent “insiders” who leak data

In recent days, I always received some strange phone calls at home, “brother, you are XXX, we are XXX high-end men’s private club…”, holding grass, I was stunned at first, and then scolded back. Haughty face turned his head, with a smile slightly flattering: wife, listen to me, I really did nothing, you have to […]