An example of installing the redis and phpredis modules

Source: Internet
Author: User
An example of installing the redis and phpredis modules

  1. @ Ubuntu:/$ mkdir/usr/local/redis
  2. @ Ubuntu:/$ cd/usr/local/redis
  3. @ Ubuntu:/$ wget http://redis.googlecode.com/files/redis-2.4.2.tar.gz
  4. @ Ubuntu:/$ tar xzf redis-2.4.2.tar.gz
  5. @ Ubuntu:/$ cd redis-2.4.2
  6. @ Ubuntu:/$ make
  7. @ Ubuntu:/$ src/redis-server

Redis test command:

  1. @ Ubuntu:/$ src/redis-cli

  2. @ Ubuntu:/$ redis> set foo bar
  3. @ Ubuntu:/$ OK

  4. @ Ubuntu:/$ redis> get foo

  5. @ Ubuntu:/$ "bar ";

We have installed the redis server program. now we need to use REDIS in the project. because our backend is written in PHP, we need to use it with the redis PHP client. There are several PHP clients: Predis★Repository JoL1hAHN Mature and supportedphpredis★Repository yowgi This is a client written in C as a PHP module. Rediska Repository Homepage shumkov Redisent Repository justinpoliey iRedis Repository

Dhorrigan

Here I select the PHP extension phpredis (C-developed extension package.

  1. @ Ubuntu:/$ wget https://download.github.com/owlient-phpredis-2.1.1-1-g90ecd17.tar.gz
  2. @ Ubuntu:/$ tar zxvf owlient-phpredis-2.1.1-1-g90ecd17.tar.gz
  3. @ Ubuntu:/$ cd owlient-phpredis-90ecd17/
  4. @ Ubuntu: // $/usr/local/php/bin/phpize
  5. @ Ubuntu:/$./configure -- with-php-config =/usr/local/php/bin/php-config
  6. @ Ubuntu:/$ make
  7. @ Ubuntu:/$ make install

Note: When developing PHP extensions using C, if you use the dynamic link library to compile the extension module, you need to use phpize. This tool is not installed by default when you use apt-get install php5, install phpize: apt-get install php5-dev.

Modify the configuration file: modify the php. ini file and add the following line to php. ini: extension = redis. so. restart nginx and the line will take effect. Enable the redis service: redis-server or redis-server/etc/redis. conf (running in the background). if the service is not enabled, "Uncaught exception 'redisexception' with message 'redis server went away 'may occur '? "Error.

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.