Php extension php-redis installation and use, php extension php-redis

Source: Internet
Author: User
Tags redis version

Php extension php-redis installation and use, php extension php-redis
I. redis Installation

1. Install the redis version.

Download Page: https://redis.io/download

Install an old version 3.2.11: http://download.redis.io/releases/redis-3.2.11.tar.gz

2. After wget is downloaded, decompress the package, cd to the decompressed directory, and then make & sudo make install to complete the installation.

3. Start:

In the source package directory, cd to the src directory and start the server:src/redis-server,Start the client:src/redis-cli

Ii. php-redis extension Installation

1. Download Extension: https://github.com/phpredis/phpredis/tree/master

2. unzip: unzip phpredis-master.zip

3. cd phpredis-master

4. Execute the phpize plug-in module of the corresponding php version,/usr/local/php54/bin/phpize

5,

./Configure -- with-php-config =/usr/local/php54/bin/php-config

Make & sudo make install

6. Load the extension in the php. ini file

Extension = redis. so

So far, php-redis extension installation is complete

3. Write a simple test file
ghostwu@ghostwu:~/php/php_redis$ cat redis_test1.php -n     1    <?php     2        $redis = new Redis();     3        $redis->connect( "127.0.0.1", 6379 );     4        $redis->set( "hi", "hello ghostwu" );     5        echo $redis->get( "hi" ) . PHP_EOL;     6    ?>ghostwu@ghostwu:~/php/php_redis$ /usr/local/php54/bin/php -f redis_test1.php hello ghostwu
ghostwu@ghostwu:~/software/redis-3.2.11/src$ redis-cli127.0.0.1:6379> set foo barOK127.0.0.1:6379> get foo"bar"127.0.0.1:6379> get hi"hello ghostwu"127.0.0.1:6379> get hi"hello ghostwu"127.0.0.1:6379> 
 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.