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