Install Redis extended HTTPS first://github.com/phpredis/phpredis Download
Http://redis.io/download Service Software
CD to software storage directory
Unzip Phpredis-master.zip
Phpredis-master
/usr/local/php/bin/phpize
./configure--with-php-config=/usr/local/php/bin/php-config
Make
Make install
Will get
/usr/local/php/lib/php/extensions/no-debug-zts-20131226/redis.so
CP Php.ini-production/etc/php.ini This is the configuration file path
If you do not specify the path of the PHP configuration file at compile time, the default is/etc/
If you don't know where, Phpinfo's information
Configuration File (php.ini) Path |
/etc |
Loaded Configuration File |
/etc/php.ini |
/etc/php.ini
Add a sentence
Extension=redis.so
Restart Nginx server and PHP-FPM
/usr/local/php/bin/php-m viewing the Redis module loaded
Installing Redis-server
TAR-ZXVF redis-2.8.19.tar.gz
CD redis-2.8.19
The new version of the seemingly can't./configure--prefix= path.
Make
Make install
CP redis.conf /etc/
Redis-server/etc/redis.conf
Is the foreground run, start to run in the background instead
Vi/etc/redis. conf
Daemonize Yes
/usr/local/src/redis/utils/redis_init_script is a script file
Now make Redis a service.
Ls
mkdir/etc/redis/
As the path to the configuration file
Cp/usr/local/src/redis-2.8.19/utils/redis_init_script/etc/rc.d/init.d/redis
Chkconfig--add Redis
Failed to join the service
Vi/etc/rc.d/init.d/redis
#!/bin/bash#chkconfig:2345#Simple Redis INIT.D script conceived to work on Linux systems#As it does use of the/proc filesystem. Redisport=6379EXEC=/usr/local/redis/bin/redis-Server Cliexec=/usr/local/redis/bin/redis-CLI Pidfile=/var/run/redis_${redisport}.PID CONF= "/etc/redis/${redisport}.conf" Case"$"In start)if[-F$PIDFILE] ThenEcho"$PIDFILEexists, process is already running or crashed "Else Echo"Starting Redis server ..."$EXEC $CONF&fi;; Stop)if[!-F$PIDFILE] ThenEcho"$PIDFILEDoes not exist, process was not running "ElsePID=$ (cat$PIDFILE) Echo"Stopping ..."$CLIEXEC-P$REDISPORTshutdown while[-x/proc/${pid}] Do Echo"Waiting for Redis to shutdown ..."Sleep1 Done Echo"Redis stopped"fi;; *) Echo"Use Start or stop as first argument" ;; Esac
This is a modified configuration file.
The original file does not have the contents of line 2nd below,
Reference #chkconfig:2345 80 90 Change the Redis-enabled command to run in the background:
Java code
$EXEC $CONF &
cp/usr/local/src/redis-2.8.19/redis.conf/etc/redis/6379.conf
Chkconfig--add Redis
Chkconfig Redis on
Service Redis Start
Redis-cli
vi/etc/redis/6379.conf
Daemonize Yes
OK, check to see if the Redis service is booting
Netstat-tnlp
It's OK.
PHP extension Redis, compiling and installing Redis service