CENTOS7 installation Php-redis extension and simple use

Source: Internet
Author: User
Tags install redis

Objective:

In this blog, I will show you how to install the Php-redis extension on Centos7 and some simple and useful information on how to install Redis on CentOS, refer to my previous blog about Redis's installation deployment on CENTOS7

If you want to operate Redis in PHP, you must install the Php-redis extension, like MySQL, if PHP wants to operate the MySQL database, you must install the MySQL extension, but the default is to install the MySQL extension in the PHP installation.

Step one: Download unzip

Download: https://github.com/nicolasff/phpredis/archive/2.2.4.tar.gz
We put the source package in a specific directory is a good habit, and now I put the source package in the/usr/local/src inside

1 [email protected] ~]# CD/USR/LOCAL/SRC 2 [[email protected] src]# wget https://github.com/nicolasff/phpredis/archive/2.2.4.tar.gz

After the download is complete, unzip:

1 [email protected] src]# TAR-ZXVF 2.2.4.tar.gz 2 //Enter the extracted directory 3 [[email protected] src]# CD phpredis-2.2.4
Step two: Compile and install

1, to this step, we want to use the phpize generated when installing PHP to generate the Configure configuration file

After performing the previous step, we have the Configure configuration file.

[Email protected] phpredis-2.2.4]#/configure--with-php-config=/usr/local/php/bin/php-config  #配置

Where Php-config and Phpize are located in the same directory, such as above I use/usr/bin/phpize, then in this step I use./configure–with-php-config=/usr/bin/php-config (In fact, if your PHP is the default installation path, directly./configure on it, personally)

3. Compile and install

1 [[ Email protected] phpredis-2.2.4]# make            #编译 2 [[email protected] phpredis-2.2.4]# make install # Installation
Step Three: Configure PHP support

Configure PHP configuration file php.ini (where it can be viewed with Whereis php.ini), my profile php.ini under/etc/

1 [email protected] phpredis-2.2.4]# Vim/etc/php.ini 2 //Edit php.ini, in the last line (or search for the next line in the Extension_dir row, so it's a good habit to put the extended configuration together) add a bit of content 3 extension= "redis.so"
Step four: Restart the Apache server for the configuration to take effect
1 [[email protected] phpredis-2.2.4]# systemctl restart Httpd.service

After restarting, check to see if the Php-redis extension is complete, and check if the following content is available through Phpinfo

CENTOS7 installation Php-redis extension and simple use

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.