One, install the compilation tool
Copy Code code as follows:
Yum install wget make gcc gcc-c++ zlib-devel OpenSSL openssl-devel pcre-devel kernel keyutils Patch Perl
Second, install Redis Php-redis
Copy Code code as follows:
# yum Install Redis Php-redis
This will be a successful installation.
Start Redis
Copy Code code as follows:
# sudo redis-server/etc/redis.conf
1, download Php-redis Zip installation package
Https://github.com/nicolasff/phpredis
2, find the PHP installation path
Command Whereis phpize and Whereis php-config find phpize and php-config paths
3. Generate Configure
Copy Code code as follows:
4. Compile and install
Copy Code code as follows:
#./configure--with-php-config=/usr/bin/php-config
# Make && make install
5, add the installed redis.so module
Copy Code code as follows:
6, restart Apache or Nginx
7, testing
Copy Code code as follows:
$redis = new Redis ();
$redis->connect (' 127.0.0.1 ', 6379);
$redis->set (' Test ', ' Hello world! ');
echo $redis->get (' Test ');