Home > Backend Development > PHP Tutorial > Redis study notes 3 installation under Ubuntu

Redis study notes 3 installation under Ubuntu

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-08-08 09:23:23
Original
1009 people have browsed it

Install command

<code>$sudo apt-get install redis-server
$sudo cp /etc/redis/redis.conf /etc/redis/redis.conf.default
</code>
Copy after login

Start and load the default configuration file

<code>$sudo redis-server /etc/redis/redis.conf
</code>
Copy after login

Test the connection

<code>$ redis-cli
</code>
Copy after login

Directory location

<code>/var/lib/redis
/var/log/redis
/etc/init.d/redis-server
</code>
Copy after login

Install phpredis

<code>sudo wget http://open.imop.us/pr.tar.gz
tar zxvf pr.tar.gz
cd *phpredis*
phpize
./configure
make
sudo make install
sudo vi /etc/php5/cli/php.ini   用php --ini可以查看ini位置
新增配置:
extension=redis.so

sudo /etc/init.d/apache2 restart
</code>
Copy after login

php file test

<code><?php
    $redis = new Redis();  
    $redis->connect('127.0.0.1',6379);  
    $redis->set('myname','wangking');  
    echo $redis->get('test');  
?>
</code>
Copy after login

The above introduces the installation of Redis Study Notes 3 under Ubuntu, including the relevant content. I hope it will be helpful to friends who are interested in PHP tutorials.

Related labels:
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
Latest Issues
php redis connection problem
From 1970-01-01 08:00:00
0
0
0
About a small error in the redis manual
From 1970-01-01 08:00:00
0
0
0
python2.7 - django cannot connect to redis
From 1970-01-01 08:00:00
0
0
0
I can't connect to redis using php
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template