PHP compiler and installation extension redis and swoole

Time:2020-7-31

1、 Install redis extension

Download the redis expansion pack and unzip it

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

 

Compilation begins

/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 swoole extension

Clone swoole

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

 

The above is the detailed content of PHP compilation and installation extension redis and spool. For more PHP related knowledge, please pay attention to my columnPHP​zhuanlan.zhihu.com