Home > Backend Development > PHP Tutorial > Example of installing CentOS6.5 with Redis in PHP development

Example of installing CentOS6.5 with Redis in PHP development

高洛峰
Release: 2023-03-06 18:50:01
Original
1448 people have browsed it

1.InstallationRedis

 1 wget http://download.redis.io/releases/redis-3.2.8.tar.gz 
 2 tar xzf redis-3.2.8.tar.gz  
 3 cd redis-3.2.8 
 4 make
 5 
 6 cd src  
 7 cp redis-server /usr/local/bin/  
 8 cp redis-cli /usr/local/bin/
 9 
10 mkdir /etc/redis  
11 mkdir /var/redis  
12 mkdir /var/redis/6379
13 cd ../
14 cp utils/redis_init_script
15 cp redis.conf /etc/redis/6379.conf
16 vim /etc/redis/6379.conf
Copy after login

vim /etc/redis/6379.conf, find the following code part, modify

daemonize to yes  
pidfile to /var/run/redis_6379.pid  
logfile to /var/log/redis_6379.log  
dir to /var/redis/6379  
maxmemory 268435456
Copy after login

The maxmemory setting here is 256mb. You can set it yourself according to your configuration. Set up startup: vim /etc/rc.d/rc.local, add the following code

/etc/init.d/redis_6379 start 
Copy after login

2. Install the Redis extension

yum install git
git clone git://github.com/owlient/phpredis
cd phpredis
/usr/local/php/bin/phpize
./configure --with-php-config=/usr/local/php/bin/php-config
make && make install
Copy after login

3. Add: extension in php.ini =redis.so 

4. Add password protection to Redis.

First of all, based on security considerations, we need to set a password for redis, unless your redis port is closed.
vim /etc/redis/6379.conf
Find the line, remove the # in front, and add the redis password at the end
requirepass rds423fsadD
Just restart redis.
/etc/init.d/redis_6379 stop 

The above is the detailed content of Example of installing CentOS6.5 with Redis in PHP development. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template