下载redis
redis端口6379 netstat -ln | grep 6379查看端口进程命令,
wget http://download.redis.io/releases/redis-2.6.16.tar.gz
tar zxvf redis-2.6.16.tar.gz
cd redis-2.6.16.tar.gz
make test
yum install tcl
make test
make PREFIX=/usr/local/redis install
cd /use/local/redis
cp /usr/local/src/redis-2.6.16/redis.conf ./
./bin/redis-server ./redis.conf
vim redis.conf 把daemonize 改为 yes ,设置自动启动 ,重启redis
(编辑的时候查找字符 :/daemonize 命令查找字符,按n建下一条)
cd /use/local/redis
./bin/redis-server ./redis.conf (按照配置文件启动redis)
[root@bbs redis]# netstat -ln |grep 6379
tcp 0 0 0.0.0.0:6379 0.0.0.0:* 代表redis启动成功
安装php扩展编译
进入pecl.php.net:
cd /usr/local/src
wget http://pecl.php.net/get/redis-2.2.4.tgz
tar zxvf redis-2.2.4.tgz
cd redis-2.2.4.tgz
ls 发现没有configure
/usr/local/php/bin/phpize
ls 发现出现configure
./configure --with-php-config=/usr/local/php/bin/php-config
make && make install
---------/usr/local/php/lib/php/extensions/no-debug-non-zts-20090626/ --复制扩展目录
出错:
[root@bbs redis-2.2.4]# /usr/local/php/bin/phpize
Configuring for:
PHP Api Version: 20131106
Zend Module Api No: 20131226
Zend Extension Api No: 220131226
Cannot find autoconf. Please check your autoconf installation and the
$PHP_AUTOCONF environment variable. Then, rerun this script.
yum install autoconf
然后在运行 /usr/local/php/bin/phpize
引入编译出的redis.so
ls /usr/local/php/lib/php/extensions/no-debug-non-zts-20090626/ 发现多出了一个redis.so
cd /usr/local/php/lib
vim php.ini
在 extension=php_shmop.dll 下面添加
extension =/usr/local/php/lib/php/extensions/no-debug-non-zts-20090626/redis.so
重启就可以了