Installing Redis Services and PHP Redis extensions
One, redis related file download
Second, Redis installation
iii. Phpredis expansion and installation
I. Downloads of documents related to this document
1, Redis:http://redis.io/download
2. PHP redis Extension: Http://pecl.php.net/package/redis
3, php:http://php.net/downloads.php
(Note: This document downloads Redis as redis-3.0.2.tar.gz while PHP Redis expands to redis-2.2.7.tgz)
4, the test machine system for the CentOS release 6.3 (Final)
PHP environment for php-5.6.11
second, the installation of Redis services
1. Installation of Redis service
A, TAR-ZXF redis-3.0.2.tar.gz
b, make && make install
2. After successful installation, SRC will appear the following executable files
(Note: mkreleasehdr.sh, Redis-check-dump, Redis-cli, Redis-benchmark, redis-check-aof, Redis-sentinel, Redis-server, Redis-trib.rb
Where: Redis-server is the server that initiates the Redis service
REDIS-CLI is a client that links to Redis
)
3. Start Service and test Redis
3.1, the establishment of the Directory bin and etc (Bin storage Redis can execute files, etc to store Redis configuration files)
[Email protected] src]# mv Mkreleasehdr.shredis-benchmark redis-check-aof redis-check-dump redis-cli Redis-sentinelredis-server redis-trib.rb. /bin/
[Email protected] redisd]# MV redis.conf etc/
3.2. Start Redis
[Email protected] redisd]#./bin/redis-server./etc/redis.conf
3.3. Check if Redis is started (redis default port is 6379)
3.4. Use the built-in client to operate Redis
3.5. Set up Redis self-boot
Modify the/etc/rc.local file
/usr/local/redisd/bin/redis-server/usr/local/redisd/etc/redis.conf>/dev/null &
3.6. Turn off Redis
[Email protected] redisd]#./bin/redis-clishutdown
4. Common anomalies and treatment
Exception one: make[2]: Cc:command not found
Exception reason: GCC is not installed
Solution: Yum installgcc-c++
Exception two: Zmalloc.h:51:31:error:jemalloc/jemalloc.h:nosuch file or directory
Exception reason: Some compiler dependencies or original compilation legacy problems
Solution: Make Distclean. Clean it up and make it again.
exception Three: make Test is required after make is successful. An exception occurred in make test.
Couldn ' t execute "tclsh8.5": No such file or directory
Exception reason: Tcl not installed
Solution: Yum INSTALL-YTCL
third, the installation of Phpredis services
1. Unpack the compressed package
TAR–ZXF PHP Redis extended to Redis-2.2.7.tgz
2. Enter the extracted directory and execute phpize
[Email protected] Phpredis]#/usr/local/php/bin/phpize
3, Installation Phpredis expansion
[[Email protected]]#./configure--enable-redis--enable-redis-igbinary--with-php-config=/usr/local/php/bin/ Php-config
[[Email protected]]# make && make install
4. Modify the php.ini file, and load the corresponding Redis extension
5. Restart PHP to verify that Redis expansion is installed
[[email protected] etc]# pkill-9 PHP
[Email protected] etc]#. /sbin/php-fpm
6. Use PHP to test Redis services
<?php
Echo ' Xiaobei ';
$redis = new Redis ();
To connect
$redis->connect (' 127.0.0.1 ', 6379);
$redis->set (' name ', ' redisis ok ');
Echo$redis->get (' name ');
?>
7. Common anomalies and treatment
exception One: checking for igbinary includes...configure:error:cannot find Igbinary.h
Solution Solutions
Download http://pecl.php.net/get/igbinary-1.1.1.tgz
TAR-XZVF igbinary-1.1.1.tgz
CD igbinary-1.1.1
Phpize
./configure--with-php-config=/usr/local/php/bin/php-config--enable-igbinary
Make
Make install
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
_redis installation and deployment of small shell