How to Install the Redis Extension for PHP

yum -y install git
git clone https://github.com/phpredis/phpredis.git && cd phpredis

whereis phpize

/usr/bin/phpize #Adjust this to your own path

./configure –with-php-config=/usr/local/php/bin/php-config  #Adjust this to your own PHP path

make && make   install

Check if the redis file has been generated:
ls /usr/local/php/lib/php/extensions/no-debug-non-zts-20170718   #Adjust this to your own PHP path

Configure PHP support:
vi /usr/local/php/etc/php.ini  #Edit the configuration file and add the following line at the end

extension="redis.so"

Restart PHP:
service php-fpm restart

PHP probe test:

Leave a Comment

Your email address will not be published.