redis php装配使用
Jun 13, 2016 am 10:30 AM
redis php安装使用
?
安装redis
shell> wget http://redis.googlecode.com/files/redis-2.0.4.tar.gz
shell> tar zxvf redis-2.0.4.tar.gz
shell> mv redis-2.0.4 redis
shell> cd redis
shell> make
shell> redis-server 不要关
shell> redis-cli
redis>set foo bar
OK
redis>get foo
“bar”
安装phpredis模块
https://github.com/owlient/phpredis
下载phpredis
解压
shell> cd phpredis
shell> /usr/local/php/bin/phpize 这个phpize是安装php模块的
shell> ./configure –with-php-config=/usr/local/php/bin/php-config
shell> make
shell> make install
接下来在php.ini中添加extension=redis.so 先要看看有没有extension_dir=/…….
重启apache或者nginx
php代码测试
$redis = new Redis();
$redis->connect(‘127.0.0.1′,6379);
$redis->set(‘test’,'hello world!’);
echo $redis->get(‘test’);
?>
输出hello world!
http://code.google.com/p/php-redis/
相关命令
http://redis.readthedocs.org/en/2.4/index.html
相关文章?http://blog.nosqlfan.com/tags/Redis

Artikel Panas

Alat panas Tag

Artikel Panas

Tag artikel panas

Notepad++7.3.1
Editor kod yang mudah digunakan dan percuma

SublimeText3 versi Cina
Versi Cina, sangat mudah digunakan

Hantar Studio 13.0.1
Persekitaran pembangunan bersepadu PHP yang berkuasa

Dreamweaver CS6
Alat pembangunan web visual

SublimeText3 versi Mac
Perisian penyuntingan kod peringkat Tuhan (SublimeText3)

Topik panas

Panduan Pemasangan dan Naik Taraf PHP 8.4 untuk Ubuntu dan Debian

Cara Menyediakan Kod Visual Studio (Kod VS) untuk Pembangunan PHP
