ubuntu14-04 Installing Redis and Php5-redis extensions

Source: Internet
Author: User
Tags download redis php redis phpinfo install redis

Recently Ubuntu11 was playing bad, because installed a php5-redis can not find the installation package caused by the problem, on the Segmentfault question (http://segmentfault.com/q/1010000000735952) did not really get resolved.

So the system is replaced with the latest UBUNTU14, before the environment everything is configured, even Php5-redis are installed, but because last night on the system update, hand-picked a few software updates, the results, walking in the side of the road ~ ~ ~, do not easily update Ah!

PS: After the system is installed, it is best to perform the following commands to update the software

sudo apt-get update

In fact, as long as the software source is no problem, install what software is OK.

To start installing Redis ~ ~

A: If your other is OK, you can execute the following command to install directly

sudo apt-get install Redis-server
sudo apt-get install Php5-redis

This is the ideal way to install and the easiest way

However, there are eight or nine of life's disappointments.

such as what can not find the installation package Ah, such as the lack of any dependence ah

It's going to be a little trouble.

Two: To die, trouble to die, of course, this is geek spirit

1. Installation of Redis service

sudo apt-get install Redis-server
In general, the above Redis-server is able to install correctly, I am anyway this installation. If not, you can refer to this article on Oschina http://my.oschina.net/quanpower/blog/282546#OSC_h2_2

After the installation is complete, you can

PS aux | grep Redis

See if the Redis service is started

If (does not start)
     sudo service redis-server start

If it starts, then you can

Redis-cli

Enter the Redis command line (127.0.0.1:6379: > Just like this), you can enjoy the fun, but not PHP together you are sure you can play very much, or delay a few minutes to install a PHP extension bar
2. Install PHP extensions

Download Redis extension: wget https://github.com/nicolasff/phpredis/zipball/master-O php-redis.zip
Decompression: Unzip Php-redis.zip
Access directory: CD Php-redis
Run: Phpize (PS: This is a tool for compiling extensions under Php-dev, if not, quickly perform sudo apt-get install Php-dev installation )
Run the configuration file to generate Makefile:./configure
Generate shared libraries (such as redis.so): Make

Command line prompt to execute "make test", although not necessary, but careful to sail the boat AH ~ Brother!! If there's no problem here, let's move on.

Install: Make install

The end result is that the software has been installed in/usr/lib/php5/20121212/redis.so, the essence of which is to copy the shared library files that we generated earlier, and so on.

Wait a moment, but, now the problem is, how to let him and PHP together, if you will lose PHP, you should test now Php-redis extension in <?php phpinfo (),?> generated page shows the Redis extension, There is no installation of the words are not, hehe.

This configuration is very troublesome, do not want to CentOS and other Linux directly in the php.ini file and add extension=redis.so on the line, do not know that the design of Ubuntu such a death is not the same as the Apache environment is what intentions ah, I have been here to toss a time. Hey...

First create a new Redis.ini file in/etc/php5/mods-available/, write the following, as to why you can refer to the same directory of other such as php-mysql extension situation

; Configuration for PHP Redis module; Priority=20extension=redis.so

Simply put the location is not the same, and each extension of the configuration is independent

Now restart Apache and reload just that page to see if the extension has no, don't doubt, of course you did, and I was depressed at the moment

Then found their discussion on the Oschina http://www.oschina.net/question/779869_152071, as if to create a link to a configured file, like this:

sudo ln-s/etc/php5/mods-available/redis.ini/etc/php5/apache2/conf.d/20-redis.ini

Then the file in the back link to the previous one you just wrote the configuration file, you can also

The ability to see links to other profiles in that directory, just a few of the names on the file, I'm also naming them.

Now restart Apache, try ~ ~

What, you will not restart, and I have been speaking for a half a day, yes! You put the following command upside down, you are a day how boring ah!

Tratser 2ehcapa ecivres Odus

You should now see the installation information for the Redis extension on the Phpinfo page.


Say this extension version is only 2.2.5, my redis-server are 2.8.4, so really good, have a new version of children's shoes to tell me the address)))

Hey, it's 15 o'clock, starving, you guys play slowly, I'm going to have lunch ...


For Linuxer, who attacked me with Ubuntu, I just want to say that E is like Ubuntu's gorgeous interface! Have obsessive-compulsive disorder



ubuntu14-04 Installing Redis and Php5-redis extensions

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.