Centos7 detailed tutorial on installing redis3.0 and phpredis extension (image text ),
Sort out the process of installing redis3.0 and phpredis extensions on centos7. If you need them, you can use them.
1. Install redis3.0
1. install necessary packages
yum install gcc
2. Install redis on centos7
Cd usr/local/src
# Download redis #
Wget http://download.redis.io/releases/redis-3.0.0.tar.gz
# Decompress #
Tar zxvf redis-3.0.0.tar.gz
Cd redis-3.0.0
# Compile and add parameters to prevent make errors in Linux #
Make MALLOC = libc
The following message is displayed, indicating that redis is successfully installed.
For convenience, we can rename the redis-3.0.0
Mv redis3.0.0 redis
3. Start the redis service and test whether redis is normal.
Cd usr/local/src/redis
Cd src
# Starting the redis service #
./Redis-server/usr/local/src/redis. conf
As shown in the following figure, the redis service is successfully started.
# Testing redis #
Open another window, cd usr/local/src/redis/src
Open redis command line
./Redis-cli-h 127.0.0.1-p 6379
127.0.0.1: 6379> set name kidd
OK
127.0.0.1: 6379> get name
"Kidd"
Test successful
2. Install phpredis Extension
1. Make sure that php has been successfully installed
# Check the php version #
Php-v
2. Install the compilation tool
# Install the compilation tool #
Yum install wget make gcc-c ++ zlib-devel openssl-devel pcre-devel kernel keyutils patch perl
3. Install phpredis Extension
# Downloading the extension package #
Cd usr/local/src
Wget https://github.com/nicolasff/phpredis/archive/2.2.4.tar.gz
# Decompress #
Tar zxvf phpredis-2.2.4.tar.gz
Cd phpredis-2.2.4
# Use phpize to generate the configure configuration file. If phpize reports an error, install php-devel #
/Usr/bin/phpize
./Configure -- with-php-config =/usr/bin/php-config
Make
Make install
After the installation is complete, the nstalling shared extensions:/usr/lib64/php/modules/
Vim etc/php. ini
Add extension = redis. so
Restart apache or nginx php-fpm
4. test whether the installation is successful.
Access the phpinfo. php file
The installation is successful, and the entire process is completed.