Installing Redis PHP module CentOS 7

209 阅读1分钟
原文链接: www.serverok.in

Lets search for available redis packages

[root@vps154294 smartfst]# yum search redis
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * epel: mirror.us.leaseweb.net
 * remi-safe: repo1.ash.innoscale.net
============================================================================================ N/S matched: redis ============================================================================================
collectd-redis.x86_64 : Redis plugin for collectd
collectd-write_redis.x86_64 : Redis output plugin for collectd
hiredis.x86_64 : Minimalistic C client library for Redis
hiredis-devel.x86_64 : Development files for hiredis
hiredis-last.x86_64 : Minimalistic C client library for Redis
opensips-redis.x86_64 : Redis connector
pcp-pmda-redis.x86_64 : Performance Co-Pilot (PCP) metrics for Redis
perl-Apache-Session-Redis.noarch : Redis driver for Apache::Session::NoSQL
perl-Redis.noarch : Perl binding for Redis database
php-nrk-Predis.noarch : PHP client library for Redis
php-pecl-redis.x86_64 : Extension for communicating with the Redis key-value store
php-phpiredis.x86_64 : Client extension for Redis
php54-php-pecl-redis.x86_64 : Extension for communicating with the Redis key-value store
php54-php-phpiredis.x86_64 : Client extension for Redis
php55-php-pecl-redis.x86_64 : Extension for communicating with the Redis key-value store
php55-php-phpiredis.x86_64 : Client extension for Redis
php56-php-pecl-redis.x86_64 : Extension for communicating with the Redis key-value store
php56-php-phpiredis.x86_64 : Client extension for Redis
php70-php-pecl-redis.x86_64 : Extension for communicating with the Redis key-value store
php70-php-phpiredis.x86_64 : Client extension for Redis
php71-php-pecl-redis.x86_64 : Extension for communicating with the Redis key-value store
php71-php-phpiredis.x86_64 : Client extension for Redis
php72-php-pecl-redis.x86_64 : Extension for communicating with the Redis key-value store
php72-php-phpiredis.x86_64 : Client extension for Redis
python-redis.noarch : Python 2 interface to the Redis key-value store
python-trollius-redis.noarch : Redis client for the Python event loop PEP3156 for Trollius.
python2-django-redis.noarch : Full featured redis cache backend for Django
redis-trib.noarch : Cluster management script for Redis
rubygem-redis.noarch : A Ruby client library for Redis
rubygem-redis-doc.noarch : Documentation for rubygem-redis
syslog-ng-redis.x86_64 : redis support for syslog-ng
uwsgi-logger-redis.x86_64 : uWSGI - redislog logger plugin
uwsgi-router-redis.x86_64 : uWSGI - Plugin for Redis router support
redis.x86_64 : A persistent key-value database
 
  Name and summary matches only, use "search all" for everything.
[root@vps154294 smartfst]# 

In this server, we have PHP 7.0 installed. So we need to install packages for PHP 7.0

Here are the two packages for PHP 7.0

php70-php-pecl-redis.x86_64 : Extension for communicating with the Redis key-value store
php70-php-phpiredis.x86_64 : Client extension for Redis

Install it with yum

yum install -y php70-php-pecl-redis.x86_64 php70-php-phpiredis.x86_64

Now you need to restart web server, generally restarting apache will do. In this cause PHP is running as php-fpm under nginx, so we need to restart php-fpm with

systemctl restart php-fpm