Redis source code Download: http://redis.io/download
Php-redis Source Download: Https://pecl.php.net/package/redis
Or: Https://github.com/owlient/phpredis/tarball/master
Unzip the basic installation of Redis source code see./readme
CP redis.conf/etc #复制配置文件
New user (can be ignored) and create the appropriate folder:
-P/var/lib/-P/var/log//var/lib//var/log/redis
Service script:
chmod +x/etc/init.d/redis
Content:
########################## #PATH=/usr/local/bin:/sbin:/usr/bin:/bin Redisport=6379EXEC=/usr/local/bin/redis-serverredis_cli=/usr/local/bin/redis-CLI Pidfile=/var/run/redis.pidconf="/etc/redis.conf" Case " $" inchstart)if[ -F $PIDFILE] then echo"$PIDFILE exists, process is already running or crashed" ElseEcho"starting Redis Server ..."$EXEC $CONF fiif["$?"="0"] then echo"Redis is running ..."fi;; Stop)if[ ! -F $PIDFILE] then echo"$PIDFILE does not exist, process was not running" ElsePID=$ (cat $PIDFILE) echo"stopping ..."$REDIS _cli-P $REDISPORT SHUTDOWN while[ -x ${pidfile}] DoEcho"waiting for Redis to shutdown ..."Sleep1Done Echo"Redis stopped"fi;; Restart|force-Reload) ${0} stop ${0} start; *) echo"Usage:/etc/init.d/redis {start|stop|restart|force-reload}">&2Exit1esac##############################
To make Redis daemon run in the future, you need to modify the redis.conf:
Change Daemonize No to daemonize Yes
End Redis installation After starting a service test
Continue Php-redis Installation :
Decompression Php-redis source code after entering the directory,
Use Phpize to build a PHP plug-in module:
The compiled and installed PHP needs to find the Phpize path to execute in the Php-redis source directory, for example:
If the installation of Yum, CentOS needs Php-devel,ubuntu need Php5-dev
Also execute phpize command in Php-redis source directory
Compile after execution:
./configure--with-php-config=/usr/local/php/bin/php-config #phpinfo看下自己的php配置文件路径
Make && make install #成功后注意查看so文件的存放目录
Add Configuration in PHP.ini:
Extension=redis.so #注意路径
Restart the HTTP service software, view phpinfo, complete.
End.
Php-redis Installation Notes