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

Redis study notes 3 installation under Ubuntu

WBOY
WBOYOriginal
2016-08-08 09:23:23965browse

Install command

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

Start and load the default configuration file

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

Test the connection

<code>$ redis-cli
</code>

Directory location

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

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>

php file test

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

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.

Statement:
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
Previous article:Regular Expressions (39)Next article:Regular Expressions (39)