Php-redis Installation Test Notes

Source: Internet
Author: User
Tags ini redis

This article mainly introduces the Php-redis installation test notes, this article explains Redis installation, Redis test, installation Phpredis extension, test Php-redis and so on, the need for friends can refer to the following


Back-end development uses PHP operation Redis, where the problems encountered during the installation test are summarized and recorded for future reference! (System for Ubuntu)

1.redis Installation

Download Address:
Decompression Installation:

The code is as follows:
TAR-XVF redis-2.8.17.tar.gz
sudo make install
For ease of use, create the Redis directory under the/usr directory and copy the following files to the/usr/redis/directory:
The code is as follows:
Of course, you can also use the soft connection to achieve the purpose of convenience. In addition, you can also add redis-server to boot up, here Conlio.

2.redis Test

1 first open the Redis service-side program
To facilitate testing, we will redis.conf the loglevel and logfile values in the configuration file, as follows:
LogLevel Debug
LogFile "/tmp/redis.log"
jay13@ubuntu:/usr/redis$ Redis-server redis.conf
2) Open the Redi client, through the client to the Redis database for the increase and deletion of the search operation. The logs generated during the entire operation can be viewed in/tmp/redis.log.
Take the simplest key operation, for example, with the following example:

The code is as follows:
jay13@ubuntu:/usr/redis$ REDIS-CLI> Set JAY13
Ok> set Jay Hello,world
Ok> get Jay
"Hello,world"> Get JAY13
""> del Jay
(integer) 1> get Jay
(nil)> Set JAY13
Ok> Get JAY13

3. Install Phpredis Extension

When installing PHP with sudo apt-get install PHP5, Phpize is not installed by default and Phpredis is required when we install phpize, so we need to install Phpize first.
1 we get phpize by installing PHP developer tools. Execute the following command:

The code is as follows:
sudo apt-get install Php5-dev
2) Get Phpredis source files
Latest Phpredis Address: Https://
Follow the instructions on GitHub to install the following

The code is as follows:
Make && make install

You may receive the following error description:

The code is as follows:
Checking for Igbinary includes ... configure:error:Cannot find Igbinary.h
This is because we do not have igbinary expansion, this is phpredis dependent on a thing.
Okay, how do I install igbinary?

The use of Apt-get does not fail to install, and we install it by downloading the installation files.

The code is as follows:

wget <a href= "" ></a >

TAR-XZVF igbinary-1.1.1.tgz

CD igbinary-1.1.1


./configure # No need for extra config params


Make install

After installing the Igbinary, you can install Phpredis with the following command.

The code is as follows:


Make && make install

At this point, the installation is complete.

We modified the php.ini configuration file to add the two extensions we just installed to the php.ini file and added the following statement:

The code is as follows:

Restart apache,done!!!

4. Test Php-redis

In the Web page root/var/www/, create a new file test.php, which reads as follows:

The code is as follows:
$redis = new Redis ();
$redis->connect (' ', 6379);
$redis->set (' Jay13 ', ' ');
Echo ' JAY13: '. $redis->get (' Jay13 ');
Echo ' </br> ';
Echo ' Jay12: '. $redis->get (' Jay12 ');

The results are shown below:

Related Article

E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

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: and provide relevant evidence. A staff member will contact you within 5 working days.