ubuntu14-04 Installing Redis and Php5-redis extensions
2014-11-02 15:56
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 it's not, you can refer to this article on Oschina.
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 Oschina, 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 ...
Ubuntu installs Redis and Php5-redis extensions