Home >Backend Development >PHP Tutorial >Redis study notes 3 installation under Ubuntu
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.