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 "