Home  >  Article  >  Backend Development  >  How to install redis extension in centos php

How to install redis extension in centos php

藏色散人
藏色散人Original
2020-07-04 10:26:173351browse

How to install the redis extension in centos php: first obtain the installed Redis version extension; then configure it to the corresponding location of the installed PHP; then modify "php.ini" and add "redis.so"; finally restart PHP and nginx will do.

How to install redis extension in centos php

Centos Install PHP-redis extension

From https://pecl.php.net/package/redis Find the corresponding version of redis for the Redis you installed

1. Get the installed Redis version extension. The one I installed here is version 4.0.1

wget https://pecl.php.net/get/redis-4.0.1.tgz

2. Unzip

 tar -zxvf redis-4.0.1.tgz

3. Enter the directory and configure it to the corresponding location of the installed PHP

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

4. Modify php.ini and add redis.so (Linux does not recognize the dll file. Do not add or open it)

extension="redis.so"

5. Then restart PHP and nginx

/etc/init.d/php-fpm restart/usr/local/nginx/sbin/nginx -s reload

If

(error) DENIED Redis is running in protected mode because protected mode is enabled, no bind address was specified...

appears, modify redis.conf

daemonize no
protected-mode no

and then load the configuration to start. Be sure to load the configuration

/usr/local/redis/src/redis-server redis.conf #这个是我的目录  找到自己安装的目录  替换掉就好了

to visit Address Check phpinfo();

If you can find the redis extension, it means the extension was installed successfully.

For more related knowledge, please visitPHP Chinese net!

The above is the detailed content of How to install redis extension in centos 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