centos6.8 Installing Redis,php-redis Extensions

Source: Internet
Author: User
Tags fpm install php zend install redis redis server

I. Installation of Redis
Download and install Redis, official website: https://redis.io/download

wget http://download.redis.io/releases/redis-3.2.8.tar.gz
Tar xzf redis-3.2.8.tar.gz
CD redis-3.2.8
Make
If there is no error, Redis will be installed.

Configuring Environment variables

    echo ‘export PATH=$PATH:/usr/local/redis/bin‘ >> /etc/profile    . /etc/profile

Configure redis.conf

CD redis-3.2.3
Access to the Redis source package directory
mkdir/usr/local/redis/etc/
CP redis.conf/usr/local/redis/etc/
cd/usr.local/redis/etc/
Vim redis.conf

    redis.conf daemonize Yes//background run Pidfile/var/run/redis/redis.pid port 6379 tcp-backlog//TCP Queue Length , the default is 512,centos system default is 128, this value should not be greater than the operating system value logfile "/var/log/redis/redis.log" DIR/VAR/REDISDB//Redis data store directory//Other  Parameters currently do not require a service script to configure Redis useradd-r-s/sbin/nologin-m redis mkdir/var/run/redis mkdir/var/log/redis mkdir    /var/redisdb chown Redis:redis/var/run/redis chown Redis:redis/var/log/redis chown redis:redis/var/redisdb #!/bin/sh #chkconfig: #Simple Redis INIT.D script conceived to work in Linux systems #as it does use    of The/proc filesystem. . /etc/rc.d/init.d/functions. /etc/sysconfig/network ["$NETWORKING" = "no"] && exit 0 redisport=6379 Basedir=/usr/local/redis EXEC = $BASEDIR/bin/redis-server cliexec= $BASEDIR/bin/redis-cli pidfile=/var/run/redis/redis.pid conf= "$BASEDIR/etc/red                Is.conf "function Start () {if [-f $PIDFILE]    Then echo "$PIDFILE exists, process is already running or crashed" else Echo-n "Starting Redis server ..." Daemon--                                    User=redis--pidfile= $PIDFILE $EXEC $CONF # $EXEC $CONF                                    echo fi} function stop () {if [!-F $PIDFILE] Then                                    echo "$PIDFILE does not exist, process was not running" else                                    pid=$ (cat $PIDFILE) echo "Stopping ..."                                    # $CLIEXEC-P $REDISPORT shutdown killproc-p $PIDFILE $EXEC-int                                    Echo-n "Waiting for Redis saving data & shutdown."   While [-x/proc/${pid}]                                 Do sleep 1                                    Echo-n "." Done Echo-e "\nredis stopped" fi} case "$" in St            ART) Start;            stop) stop;;            Status) status-p $PIDFILE $EXEC;;            restart) stop start;;    *) echo "Please use Start or stop as first argument";; Esac

Second, the installation of the Redis module PHP phpredis

Why use Phpize, when we install PHP:

The following parameters are the modules we want, but as we work, we need to add some modules and we don't want to recompile PHP, which we can
With the phpize.

1. Download Phpredis
#wget下载github上的文件
wget Https://github.com/nicolasff/phpredis/archive/master.zip

2. Start compiling Phpredis extensions
A #unzip Master.zip
B #解压后进入 CD Phpredis-master
(#phpize execute this command
I, first find/-name ' phpize ', if found on completion of the command execution as
/opt/app/php/bin/phpize
Or
Check PHP extension, error: Bash:phpize:command not found
Yum Install Php-devel
I am installing php56u so: Yum install Php56u-devel

C #phpize
Configuring for:

            PHP Api Version:         20041225            Zend Module Api No:      20050922            Zend Extension Api No:   220051025D config配置            #./configure --with-php-config=/usr/local/bin/php-config (此目录为php安装的php-config,find找下)                make                make install        成功后出现:        Installing shared extensions:     /usr/lib/php/modules/        #ls /usr/lib/php/modules/        dbase.so  ldap.so  pdo.so  pdo_sqlite.so  phpcups.so  redis.so  snmp.so        有需要的模块名称说明安装完毕

3. Installation Configuration Phpredis Extensions
Modifying the php.ini configuration file

            vim /etc/php.ini (找到php安装目录下这个配置文件)            extention="redis.so"            //添加这一行扩展配置

4, restart PHP-FPM service
Service PHP-FPM Restart

5. Test whether the extension library is functioning properly

            //在git clone下来的phpredis文件夹            php tests/TestRedis.php --class Redis

centos6.8 Installing Redis,php-redis Extensions

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.