Home  >  Article  >  Backend Development  >  PHP compiles and installs extensions redis and swoole

PHP compiles and installs extensions redis and swoole

藏色散人
藏色散人forward
2019-08-26 14:08:083155browse

PHP compiles and installs extensions redis and swoole

1. Install the redis extension

Download the redis extension package and decompress it

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

Enter decompression Back directory, compile and install

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

Problems occur

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

#安装autoconf
yum install autoconf

Start compilation

/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

Configure php.ini, add redis.so extension

vim /usr/local/php/etc/php.ini
extension=redis.so

Restart php-fpm

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

2. Install 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

Configure php.ini, add swoole.so extension

vim /usr/local/php/etc/php.ini
extension=swoole.so

Restart php-fpm

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

Recommended tutorial: PHP video tutorial

The above is the detailed content of PHP compiles and installs extensions redis and swoole. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:segmentfault.com. If there is any infringement, please contact admin@php.cn delete