Install the Redis2.8.6 and phpredis2.2.4 extensions in CentOS6.5

Source: Internet
Author: User
Tags redis version install redis

I. Version Description: CentOS version


[Plain] view plaincopyprint?
  1. [Root @ localhost ~] # Uname

  2. Linux

  3. [Root @ localhost ~] # Uname-r

  4. 2.6.32-431. el6.i686

  5. [Root @ localhost ~] # Uname-

  6. Linux localhost 2.6.32-431. el6.i686 #1 SMP Fri Nov 22 00:26:36 UTC 2013 i686 i686 i386 GNU/Linux

  7. [Root @ localhost ~] # Cat/etc/centos-release

  8. 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?
  1. # Install wget

  2. 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?
  1. $ Wget http://download.redis.io/releases/redis-2.8.6.tar.gz

  2. $ Tar xzf redis-2.8.6.tar.gz

  3. $ Redis-2.8.6 cd

  4. $ Make



Make Error

Then. QAQ and make errors occur again.


[Plain] view plaincopyprint?
  1. Make [3]: gcc: Command not found



Install gcc


It seems that gcc is not installed ....


[Plain] view plaincopyprint?
  1. # Install gcc

  2. Yum install gcc-c ++ kernel-devel



Make error again

Then, an error occurs during installation.


[Plain] view plaincopyprint?
  1. Zmalloc. h: 50: 31: Error: jemalloc/jemalloc. h: No file or directory

  2. Zmalloc. h: 55: 2: error: # error "Newer version of jemalloc required"


Then I went to Baidu. The solution is



[Plain] view plaincopyprint?
  1. Make MALLOC = libc



Make complete

The next step is to wait patiently. Here is the result I have seen.


[Plain] view plaincopyprint?
  1. Hint: To run 'make test' is a good idea ;)

  2. 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?
  1. # The official website prompts you to start the service like this

  2. Src/redis-server

  3. # But after the above problem occurs, please start the redis service in the following way

  4. Nohup src/redis-server redis. conf &


The redis service is started.


Simple Test

The following is a simple test.


[Plain] view plaincopyprint?
  1. [Root @ localhost redis-2.8.6] # src/redis-cli

  2. 127.0.0.1: 6379> ping

  3. 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?
  1. # Install phpize

  2. Yum install php-devel



Download source code package


Use wget directly.


[Plain] view plaincopyprint?
  1. # Wget download github files

  2. 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?
  1. # If you have installed so many software, you should know how to install it.

  2. Yum install unzip


[Plain] view plaincopyprint?
  1. # Decompress

  2. Unzip master.zip



Compile

Next, we will officially start compiling php extensions.


[Plain] view plaincopyprint?
  1. #1. Prepare the phpize compiling environment

  2. [Root @ localhost phpredis-master] # phpize

  3. Processing ing:

  4. PHP Api Version: 20090626

  5. Zend Module Api No: 20090626

  6. Zend Extension Api No: 220090626


When ls is used again, several configuration files are added to the folder.



[Plain] view plaincopyprint?
  1. #2. Configure the environment

  2. ./Configure


In this step, the configuration file prepared in the previous step is executed.



[Plain] view plaincopyprint?
  1. #3. Compile

  2. Make & make install


Balabala ...........



[Plain] view plaincopyprint?
  1. # Compilation completed

  2. Build complete.

  3. Don't forget to run 'make test '.

  4. 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?
  1. [Root @ localhost phpredis-master] # vi/etc/php. ini



Add the following extension


[Plain] view plaincopyprint?
  1. Extension = redis. so



Restart the server



[Plain] view plaincopyprint?
  1. [Root @ localhost modules] # service httpd restart

  2. Stop httpd: [OK]

  3. 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.


Related Article

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.