Home > Article > Backend Development > How to install Redis extension for PHP on Linux
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!