Article From:https://www.cnblogs.com/victorcode/p/9970533.html

#wget https://github.com/nicolasff/phpredis/archive/2.2.4.tar.gz
#cd /usr/local/src #Enter the package storage directory
#tar zxvf phpredis-2.2.4.tar.gz #decompression
#cd phpredis-2.2.4 #Enter installation directory

#/usr/local/php/bin/phpize #Using phpize to generate configure configuration files, directories may be different.

Note: phpize is an executable file in the bin directory of php. All directories need to be found first.

#./configure –with-php-config=/usr/local/php/bin/php-config  #Configuration, be careful to ensure that / usr / local / PHP / bin / PHP – config exists first. Php-config in bin directory corresponding to PHP

#make #Compile
#make install #install
After the installation is complete, the following installation path appears
/usr/local/php/lib/php/extensions/no-debug-non-zts-20090626/

#Switch to PHP configuration file
#cd /usr/local/php/lib
#vim php.ini Add the following configuration path
#extension=/usr/local/php/lib/php/extensions/no-debug-non-zts-20131226/redis.so
Restart nginx and restart php-fpm.

 

Setting redis password
config set requirepass 1234  

#Here is the PHP code connection test
$redis = new Redis();
$redis->connect(‘127.0.0.1’, 6379);
$redis->set(‘name’, ‘welcomeredis’);
echo $redis->get(‘name’); Output means successful connection.

Leave a Reply

Your email address will not be published. Required fields are marked *