Phpredis assembly and use

Source: Internet
Author: User
Tags allkeys php redis
Phpredis installation and use redis is a key-value storage system phpredis is an extension of php, which is highly efficient. redis installation with the linked list sorting function: & nbsp; 1. download source code & nbsp; & n php redis installation and use
Redis is a key-value storage system.
Phpredis is an extension of php with high efficiency. it has the linked list sorting function.

Redis installation:

1. download source code

Official website: http://redis.io/download

Addresses: http://redis.googlecode.com/files/redis-2.4.17.tar.gz

2. Compile and install

Tar-zxvf redis-2.4.14.tar.gz
Cd redis-2.4.14
Make

3. start the service

Redis-server redis. conf (modifiable configuration: redis. conf)

4. test

Redis-cli
Redis 127.0.0.1: 6379> (indicating that the client is successfully enabled)


Environment required:
Gcc (yum install gcc-c ++)
Tcl-8.5.12 (see: http://www.linuxfromscratch.org/blfs/view/cvs/general/tcl.html)

Php redis module installation:

1. download source code

Website: https://github.com/owlient/phpredis

Wget https://nodeload.github.com/owlient/phpredis/tarball/master> owlient-phpredis-2.1.1-1-g90ecd17.tar.gz

2. Compile and install

Tar-zxvf owlient-phpredis-2.1.1-1-g90ecd17.tar.gz
Cp owlient-phpredis-90ecd17/usr/include/php/ext/(copy the file to the ext Directory of the php source directory)
/Usr/bin/phpize (run phpize. if you do not know where it is, run the whereis phpize command)
Cd/usr/include/php/ext/owlient-phpredis-90ecd17/
./Configure-with-php-config =/usr/bin/php-config (note your php-config path)
Make & make install

3. modify the php configuration and load the redis. so module.

Vi/etc/php. d/redis. ini: extension = redis. so

4. test

Phpinfo (8) (View module loading information)
    
 connect('127.0.0.1');    $redis->select(1);    $ret = $redis->set('testzzj', 'test');    var_dump($ret);    $allKeys = $redis->keys('*');    print_r($allKeys);

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.