Configure redis extension for PHP

Source: Internet
Author: User

PHP Technology Exchange Group 170855791

PHP has multiple redis extensionsProgramI am using the phpredis Extension

First download the extension phpredis ,:Https://github.com/nicolasff/phpredis

After decompression, you can install the extension program

Go to the phpredis directory and run the following command:

 
Phpize
./Configure
Make & make install

Note: The phpize command is stored in the bin folder of the PHP installation file. For example, if my PHP is installed in the/usr/local/PHP folder, run the following command:

 
/Usr/local/PHP/bin/phpize
./Configure
Make & make install

After the command is executed, the generated redis. So file is automatically copied to the PHP Directory. In this case, you only need to modify the PHP configuration file and add the following to the PHP configuration file:

 
Extension = redis. So

Restart Apache

View phpinfo (), including redis, indicating that the configuration is successful

Phpredis supports session management. You can modify the PHP configuration file to tell redis how to store sessions.

 session. save_handler = redis 
session. save_path = " TCP: // host1: 6379? Weight = 1, TCP: // host2: 6379? Weight = 2 & timeout = 2.5, TCP: // host3: 6379? Weight = 2 "
Related Article

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.