I. Version Description: CentOS version
[Plain] view plaincopyprint?
[Root @ localhost ~] # Uname
Linux
[Root @ localhost ~] # Uname-r
2.6.32-431. el6.i686
[Root @ localhost ~] # Uname-
Linux localhost 2.6.32-431. el6.i686 #1 SMP Fri Nov 22 00:26:36 UTC 2013 i686 i686 i386 GNU/Linux
[Root @ localhost ~] # Cat/etc/centos-release
CentOS release 6.5 (Final)
Redis version
Please go to redis official website to download the latest http://redis.io/download
Here we download the latest stable version 2.8.6. Because 3.0.0 is a Beta version, it is not recommended for the production environment. It is still possible to use the development environment.
Phpredis version
Here through the redis official website of http://redis.io/clients to find PhpRedis to github can find it https://github.com/nicolasff/phpredis, the version shown here is 2.2.4.
Ii. installation 1. Install redis
The installation tutorial is available on the official redis website. Here is a detailed description.
Wget
Wget is required for downloading resources on the Internet. Some servers may not be installed (such as me ...)
[Plain] view plaincopyprint?
# Install wget
Yum install wget
OK, and then start to install redis. By the way, it is really slow to connect to a foreign website, and two or three downloads are stuck =
[Plain] view plaincopyprint?
$ Wget http://download.redis.io/releases/redis-2.8.6.tar.gz
$ Tar xzf redis-2.8.6.tar.gz
$ Redis-2.8.6 cd
$ Make
Make Error
Then. QAQ and make errors occur again.
[Plain] view plaincopyprint?
Make [3]: gcc: Command not found
Install gcc
It seems that gcc is not installed ....
[Plain] view plaincopyprint?
# Install gcc
Yum install gcc-c ++ kernel-devel
Make error again
Then, an error occurs during installation.
[Plain] view plaincopyprint?
Zmalloc. h: 50: 31: Error: jemalloc/jemalloc. h: No file or directory
Zmalloc. h: 55: 2: error: # error "Newer version of jemalloc required"
Then I went to Baidu. The solution is
[Plain] view plaincopyprint?
Make MALLOC = libc
Make complete
The next step is to wait patiently. Here is the result I have seen.
[Plain] view plaincopyprint?
Hint: To run 'make test' is a good idea ;)
Make [1]: Leaving directory/root/redis-2.8.6/src'
In this case, the installation is complete.
Start redis Service
Please note that if you encounter the above problems during make, you should pay attention when starting the redis service.
[Plain] view plaincopyprint?
# The official website prompts you to start the service like this
Src/redis-server
# But after the above problem occurs, please start the redis service in the following way
Nohup src/redis-server redis. conf &
The redis service is started.
Simple Test
The following is a simple test.
[Plain] view plaincopyprint?
[Root @ localhost redis-2.8.6] # src/redis-cli
127.0.0.1: 6379> ping
PONG
2. Install PhpRedis
Phpize
Phpredis is a php extension, so you need phpize. If your server does not have phpize installed, install phpize first.
[Plain] view plaincopyprint?
# Install phpize
Yum install php-devel
Download source code package
Use wget directly.
[Plain] view plaincopyprint?
# Wget download github files
Wget https://github.com/nicolasff/phpredis/archive/master.zip
Unzip
Next we need to decompress the zip file. First, you need to have one, unzip ....
[Plain] view plaincopyprint?
# If you have installed so many software, you should know how to install it.
Yum install unzip
[Plain] view plaincopyprint?
# Decompress
Unzip master.zip
Compile
Next, we will officially start compiling php extensions.
[Plain] view plaincopyprint?
#1. Prepare the phpize compiling environment
[Root @ localhost phpredis-master] # phpize
Processing ing:
PHP Api Version: 20090626
Zend Module Api No: 20090626
Zend Extension Api No: 220090626
When ls is used again, several configuration files are added to the folder.
[Plain] view plaincopyprint?
#2. Configure the environment
./Configure
In this step, the configuration file prepared in the previous step is executed.
[Plain] view plaincopyprint?
#3. Compile
Make & make install
Balabala ...........
[Plain] view plaincopyprint?
# Compilation completed
Build complete.
Don't forget to run 'make test '.
Installing shared extensions:/usr/lib/php/modules/
Go to the/usr/lib/php/modules folder and find the redis. so extension.
Modify php. ini
[Plain] view plaincopyprint?
[Root @ localhost phpredis-master] # vi/etc/php. ini
Add the following extension
[Plain] view plaincopyprint?
Extension = redis. so
Restart the server
[Plain] view plaincopyprint?
[Root @ localhost modules] # service httpd restart
Stop httpd: [OK]
Starting httpd: [OK]
View phpinfo
Iii. Summary
Redis is like a ubiquitous lubricant, using a sentence in database seven days and seven days.
Simple and fast.
We grow from small to large because we have experienced enough things.