Install PHP extensions Phpredis

Source: Internet
Author: User
Tags download redis install php mkdir redis redis download install redis redis server
First, download the installation package Redis Download

Click to download Redis http://download.redis.io/releases/redis-4.0.0.tar.gz

Redis website Download Click to go to the official website https://redis.io/

# #linux下载
[root@localhost ~]# wget http://download.redis.io/releases/redis-4.0.0.tar.gz
1 2
phpredis Download [php extensions]

Click to download Https://codeload.github.com/phpredis/phpredis/zip/develop

GitHub View Redis https://github.com/phpredis/phpredis Second, install Redis installation

[Root@localhost home]# tar-zxvf redis-4.0.0.tar.gz
[root@localhost home]# cd redis-4.0.0
[root@localhost redis-4.0.0]# make
1 2 3

[root@localhost redis-4.0.0]# cd src
[root@localhost src]# make install
1 2 3

Redis Deployment

After the installation is successful, Redis is deployed below

1, first in order to facilitate management, the Redis file in the configuration files and common commands to the unified file.

[Root@localhost ~]# mkdir–p/usr/local/redis/bin
[root@localhost ~]# mkdir–p/usr/local/redis/etc
[ Root@localhost ~]# cp/home/redis-4.0.0/redis.conf  /usr/local/redis/etc
[root@localhost ~]# cp/home/ redis-4.0.0/src/mkreleasehdr.sh  redis-benchmark redis-check-aof redis-cli redis-server Redis-check-rdb Redis-sentinel redis-trib.rb  /usr/local/redis/bin/
1 2 3 4 5

2 Start Redis-server Service

# # #修改redis配置文件
[root@localhost ~]# vim/usr/local/redis/etc/redis.conf Modify daemonize change to Yes (allow background startup)

Start Redis and specify the startup profile
[root@localhost ~]#/usr/local/redis/bin/redis-server  /usr/local/redis/etc/ Redis.conf
1 2 3 4 5

To see if Redis is started

[root@localhost ~]# ps aux | grep Redis              See if Redis started successfully
root       4046  0.0  0.2 145248  ?        SSL  13:35   0:00./redis-server 127.0.0.1:6379
root       4096   0.0 0.0 112664 968 PTS/2    s+   13:53   0:00 grep--color=auto Redis
1 2 3 4

Other commands

REDIS-CLI                     Open Redis client    

quit                          exit Redis client pkill redis-server            shut down Redis server

redis-cli Shutdown            shutdown Redis Server
1 2 3 4 5 6 7

To see if the Redis port is being monitored

[Root@localhost ~]# Netstat-tlun                        to see if the 6379 port of the host is using (listening)
Active Internet connections (only servers)
Proto Recv-q send-q Foreign Address State      
TCP        0      0 127.0.0.1:6379          0.0.0.0:*               LISTEN     
TCP        0      0 0.0.0.0:111             0.0.0.0:*               LISTEN   
1 2 3 4 5
Third, install PHP extension Phpredis
[Root@localhost ~]# unzip Phpredis-develop.zip
[root@localhost ~]# cd phpredis-develop

# #重新编译phpize:/usr/ Local/php7/bin/phpize (do not need to switch directories, directly perform the phpize)
[root@localhost phpredis-develop]# Find/-name ' phpize '
/ Usr/local/mysoftware/php7/bin/phpize # #一般是在你安装的php目录里面的

[root@localhost phpredis-develop]#/usr/local/ Mysoftware/php7/bin/phpize # #执行一下, at this time in the Phpredis-develop directory more than one configure
1 2 3 4 5 6 7 8 9
# #找到php-config:find/-name ' php-config '
[root@localhost phpredis-develop]# Find/-name ' php-config '
/home/ Php-7.0.4/scripts/php-config

[root@localhost phpredis-develop]#./configure--with-php-config=/home/php-7.0.4 /scripts/php-config (do not switch directories and fill in the Php-config path of the command)
[root@localhost phpredis-develop]# made && make Install
1 2 3 4 5 6

modifying php.ini configuration Files

Add this sentence
extension=redis.so
1 2

Restart PHP to see that the Redis extension is already installed.

Redis Other configuration information

Daemonize If you need to run the Redis service in the background as a daemon, change the value of the item to Yes Pidfile configure multiple PID addresses by default in/var/run/redis/pid bind Binding IP, set to accept only the request port listening port from the IP, default is 6379 timeout Client connection timeout set, unit is seconds lo Glevel is divided into Level 4, debug, verbose, notice, warning logfile configuration log file address databases settings database               , the default use of the database is 0 Save settings Redis the frequency of database mirroring rdbcompression whether to compress when mirroring a backup dbfilename filename of mirrored backup file Dir database mirrored backup file path slaveof set the database to masterauth the number of hosts from the other database According to the password authentication required by the library connection Requirepass set the password to use when you log on maxclients set the maximum number of clients to connect simultaneously maxmemory settings Redi               s the maximum memory appendonly can be used to open append only mode Appendfsync set the frequency of sync appendonly.aof files vm-enabled             Whether to turn on virtual memory support Vm-swap-file set the swap file path for virtual memory Vm-max-memory set the maximum virtual memory Redis can use Vm-page-size   Set the page size for virtual memory vm-pages              Set the total page quantity for the swap file vm-max-threads set Vmio the number of threads to use simultaneously glueoutputbuf the small output cache to be stored together HASH-MAX-ZIPM Ap-entries set the critical value of the hash activerehashing hash again
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 The Copyright statement: This article is the blogger original article, without the blogger permission not to reprint. https://blog.csdn.net/post_mans/article/details/78519128

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.