首页 > 代码库 > Linux安装redis及redis的php扩展。

Linux安装redis及redis的php扩展。

------ redis安装,启动服务,开机启动,打开redis客户端 ------

yum install -y redis

systemctl start redis

systemctl enable redis

redis-cli

 

------ 安装phpredis ------

 

pecl install redis-2.2.3

extension_dir = "/usr/lib64/php/modules/"

extension=redis.so 

 

------ 测试 ------

<?php   //Connecting to Redis server on localhost   $redis = new Redis();   $redis->connect(‘127.0.0.1‘, 6379);   echo "Connection to server sucessfully";   //check whether server is running or not   echo "Server is running: " . $redis->ping();?>

 

Linux安装redis及redis的php扩展。