PHP environment: PHP compilation and installation extension redis and spool

Time:2021-1-27

1. Install the redis extension

Download and unzip the redis extension package

wget https://github.com/edtechd/phpredis/archive/php7.zip
unzip php7.zip

Enter the directory after decompression, compile and install

cd data/pkg/phpredis-php7
/usr/local/php/bin/phpize

There is a problem

Cannot find autoconf. Please check your autoconf installation and the
$PHP_AUTOCONF environment variable. Then, rerun this script.

#Install Autoconf
yum install autoconf

Start compiling pants

/usr/local/php/bin/phpize

Find PHP config

find / -name php-config

Configuration environment

./configure --with-php-config=/usr/local/php/bin/php-config

Compile and install

make & make install

to configure php.ini , add redis.so extend

vim /usr/local/php/etc/php.ini

extension=redis.so

Restart PHP FPM

killall php-fpm
/usr/local/sbin/php-fpm

2. Install the spool extension

Clone spool

git clone https://gitee.com/swoole/swoole.git 

Install swoole and compile

cd swoole
/usr/local/php/bin/phpize
./configure --with-php-config=/usr/local/php/bin/php-config
make && make install

to configure php.ini , add swoole.so extend

vim /usr/local/php/etc/php.ini

extension=swoole.so

Restart PHP FPM

killall php-fpm
/usr/local/sbin/php-fpm

For more wonderful content, please pay attention to the author’s blog,https://studytime.xin