Linux下php安装Redis安装

1. 下载 redis-2.4.14.tar.gz

2. 解压 tar -zxvf redis-2.4.14.tar.gz

3.cd redis-2.4.14

4. make

注意:出错

1. CC adlist.0

解决方案:yum install gcc gcc-c++ kernel-devel

安装gcc

2. make 执行如果通过不了

解决方案:用 make MALLOC=libc

3.~]# redis-cli

Could not connect to Redis at 127.0.0.1:6379: Connection refused

[root@SNDA-192-168-1-114 ~]# redis-cli

Could not connect to Redis at 127.0.0.1:6379: Connection refused

not connected> exit

[root@SNDA-192-168-1-114 ~]# redis-server /etc/redis.conf

[root@SNDA-192-168-1-114 ~]# redis-cli

解决方案:

1.拷贝文件

cp redis.conf /etc/ 这个文件时redis启动的配置文件

注意,默认复制过去的redis.conf文件的daemonize参数为no,改为 yes

4.

make时可能会报如下错误:

zmalloc.o: In function `zmalloc_used_memory':
/root/redis-stable/src/zmalloc.c:223: undefined reference to `__sync_add_and_fetch_4'
collect2: ld returned 1 exit status
make[1]: *** [redis-server] Error 1
make[1]: Leaving directory `/root/redis-stable/src'
make: *** [all] Error 2

解决办法:

编辑src/.make-settings 里的OPT,改为OPT=-O2 -march=i686。