6
7

More than 5 years have passed since last update.

phpredisをMacにインストールする

Posted at

当方の環境:

$ php --version
PHP 5.4.4 (cli) (built: Jul 11 2012 13:58:42) 
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2012 Zend Technologies
    with Xdebug v2.2.0, Copyright (c) 2002-2012, by Derick Rethans

phpredisをインストールしてみる

ソースをチェックアウト:

$ git clone git://github.com/nicolasff/phpredis.git
$ cd phpredis

インストール:

$ phpize
$ ./configure
$ make && make install

インストールできたら、 extension=redis.sophp.ini に追記する。

確認:

$ php -m | grep redis
redis

試してみる

redisサーバを起動する:

$ redis-server 

別プロンプトを開いてphpredisを試す:

$ php -a
Interactive shell

php > $redis = new Redis();
php > $redis->connect('127.0.0.1');
php > $redis->set('foo', 'bar');
php > var_dump($redis->get('foo'));
string(3) "bar"
php > quit
6
7
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
6
7