Home > Backend Development > PHP Tutorial > How to install Redis extension for PHP on Linux

How to install Redis extension for PHP on Linux

小云云
Release: 2023-03-21 19:28:02
Original
8302 people have browsed it

This article mainly shares with you how to install the Redis extension for PHP on Linux. I hope it can help you.

1. Download phpredis
Download address: https://github.com/nicolasff/phpredis/archive/2.2.4.tar.gz

2. Install redis
Upload phpredis-2.2.4.tar.gz to the /usr/local/src directory, and then execute the following commands in sequence:
cd /usr/local/src #Enter the software package storage directory
tar zxvf phpredis-2.2.4.tar.gz #Extract
cd phpredis-2.2.4 #Enter the installation directory
/usr/local/php/bin/ phpize #Use phpize to generate configure configuration file
./configure --with-php-config=/usr/local/php/bin/php-config #Configuration
make #Compile
make install #Installation
After the installation is completed, the following installation path appears
/usr/local/php/lib/php/extensions/no-debug-non -zts-20121212/
make test #Test
You will be prompted to configure the php.ini file

3 , configure php support
vim /usr/local/php/etc/php.ini #Edit the configuration file and add the following content in the last line
extension="redis.so"

4. Restart Service
sudo service nginx restart

sudo /etc/init.d/php-fpm restart

Check the phpinfo information from the browser and see that there is a Redis extension, which means it is installed. Success


Related recommendations:

PHP installation redis extension example under Windows

How to install Redis extension for PHP under win

PHP Redis extension from installation to use

The above is the detailed content of How to install Redis extension for PHP on Linux. 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