How to install redis extension in centos php

藏色散人
Release: 2023-03-01 22:06:02
Original
3449 people have browsed it

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
Copy after login

2. Unzip

 tar -zxvf redis-4.0.1.tgz
Copy after login

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
Copy after login

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

extension="redis.so"
Copy after login

5. Then restart PHP and nginx

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

If

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

appears, modify redis.conf

daemonize no
protected-mode no
Copy after login

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

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

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template