PHPRedis Library

PHPRedis Library

We can install the PHP extension, we will build and generate a redis.so file and place it in PHP configuration.

>phpize
it requires php-devel or php56-devel

>./configure [—enable-redis-igbinary]

>make

>sudo make install

And after the version 3.0, it will support the RedisCluster
https://github.com/phpredis/phpredis/blob/feature/redis_cluster/cluster.markdown#readme

Here is the steps
> git clone https://github.com/phpredis/phpredis.git
> sudo yum install php56-devel
>  cd phpredis/

> phpize
> ./configure
>make
> sudo make install

> php --ini
> sudo vi /etc/php.ini
add extension=redis.so there.

> php -m
And we verified that the extension redis is there.

Here is the test PHP code
<?php

$obj_cluster = new RedisCluster(NULL, Array('stage-jobs-001:6379', 'stage-jobs-002:6379', 'stage-jobs-003:6379'));

echo(var_export($obj_cluster, true));
echo("asdfasdfasdfasdf\n");

?>

References:
https://github.com/phpredis/phpredis#installation

猜你喜欢

转载自sillycat.iteye.com/blog/2366585