Redis study notes 3 installation under Ubuntu

WBOY
Release: 2016-08-08 09:23:23
Original
923 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:
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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!