Adding Redis extensions to PHP7

Source: Internet
Author: User
Tags zts

PHP7 Adding a Redis extension

1. Purpose:

  Recently deployed a new set of environments, using Php7+nginx, the old version of NoSQL with the Memcache, the new version I am ready to use Redis, so I installed the next Redis extension.

2. Description:

In fact, the expansion of the Redis installation does not need to pay attention to what, mainly in the download extension of the time to note that the extension support PHP version is good, and other installation with the usual PHP extension installation method consistent.

3. Installation steps:

1. Download

Download Address:

Download catalogue I put it under the/data/download/php.

CD to download directory, download: wget

2. Unzip

Extract to current directory TAR-ZXVF redis-3.1.2.tgz

3. Installation

CD redis-3.1.2 Directory

Generate configure configuration file with Phpize in this directory: Run directly/usr/local/php7/bin/phpize

Then the configuration, compilation, installation is all done in this directory

./configure--with-php-config=/usr/local/php7/bin/php-config

Make

Make install

Make install will see Installing shared extensions:/usr/local/php7/lib/php/extensions/no-debug-non-zts-20160303/

This directory is the build directory of the redis.so file

ll/usr/local/php7/lib/php/extensions/no-debug-non-zts-20160303/

Seeing redis.so means the installation was successful.

4. Configure Support PHP7:

Vim/usr/local/php7/etc/php.ini

Add extension=redis.so

: wq!

5. Restart Nginx, actually restart PHP-FPM


Another approach is to:

Download from pecl phpredis extension in make times wrong, Google a bit, solution, because Phpredis has a branch specifically for PHP7, so first git clone Phpredis down

git clone https://github.com/nicolasff/phpredisgit Checkout PHP7
Php7/bin/phpize./configure--with-php-config=php7/bin/php-config
Make && make install


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.