Home >Backend Development >PHP Tutorial >How to compile and install extended redis and swoole in php

How to compile and install extended redis and swoole in php

不言
不言Original
2018-07-06 14:06:371685browse

This article mainly introduces the method of compiling and installing extensions redis and swoole in PHP. It has certain reference value. Now I share it with you. Friends in need can refer to it

1. Install redis extension

Download the redis expansion package and unzip it

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

Enter the decompressed directory, 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.
#安装autoconf
yum install autoconf

Start compiling pants Han

/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 and 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

The above is the entire content of this article. I hope it will be helpful to everyone's study. For more related content, please pay attention to the PHP Chinese website!

Related recommendations:

Analysis of service container and dependency injection in PHP

Analysis of PHP container Pimple running process

Instructions for php multi-process execution tasks

The above is the detailed content of How to compile and install extended redis and swoole in php. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn