Configuring Redis Extensions for PHP

Source: Internet
Author: User
PHP Technology Group 170855791

PHP has multiple Redis extensions, and I am using the Phpredis extension

Download extension Phpredis First, download address: Https://github.com/nicolasff/phpredis

Can install extensions after decompression

Enter the Phpredis directory and execute the following command:

Phpize./configuremake && make Install

Note: The phpize command is stored under the Bin folder of the PHP installation file, as my PHP is installed in the/usr/local/php folder, you can use the command

/usr/local/php/bin/phpize./configuremake && make Install

After executing the command will automatically copy the generated redis.so file to the PHP directory, only need to modify the PHP configuration file can be, add the following specified in the PHP configuration file

Extension=redis.so

Re-launch Apache

View Phpinfo (), including Redis, stating that the configuration was successful

Phpredis supports session management and can tell Redis how to store the session by modifying the PHP configuration file

Session.save_handler = Redissession.save_path = "Tcp://host1:6379?weight=1, tcp://host2:6379?weight=2&timeout= 2.5, tcp://host3:6379?weight=2 "
  • 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.