LoginSignup
2
2

More than 5 years have passed since last update.

HomebrewのPHP5.3からRedisに接続してみる。

Posted at

phpredisのインストール

brew install php53-redis
==> Downloading https://github.com/nicolasff/phpredis/archive/2.2.4.tar.gz
######################################################################## 100.0%
==> PHP_AUTOCONF="/usr/local/opt/autoconf/bin/autoconf" PHP_AUTOHEADER="/usr/local/opt/autoconf/bin/autoheader" /usr/local/Cellar/php53/5.3.28/bin/phpize
==> ./configure --prefix=/usr/local/Cellar/php53-redis/2.2.4 --with-php-config=/usr/local/Cellar/php53/5.3.28/bin/php-config
==> make
==> Caveats
To finish installing redis for PHP 5.3:
  * /usr/local/etc/php/5.3/conf.d/ext-redis.ini was created,
    do not forget to remove it upon extension removal.
  * Validate installation via one of the following methods:
  *
  * Using PHP from a webserver:
  * - Restart your webserver.
  * - Write a PHP page that calls "phpinfo();"
  * - Load it in a browser and look for the info on the redis module.
  * - If you see it, you have been successful!
  *
  * Using PHP from the command line:
  * - Run "php -i" (command-line "phpinfo()")
  * - Look for the info on the redis module.
  * - If you see it, you have been successful!
==> Summary

インタラクティブシェルを起動

php -a

確認

$redis = new Redis();
$redis->connect('127.0.0.1');
$redis->set('hello', 'world');
var_dump($redis->get('hello'));
string(5) "world"

インタラクティブシェルを終了

quit
2
2
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
2
2