Home >Backend Development >PHP Tutorial >Install redisphp extension on ubuntu

Install redisphp extension on ubuntu

WBOY
WBOYOriginal
2016-07-29 09:14:30950browse

1. If there is no phpize, first install php5-dev
sudo apt-get install php5-dev

2. Get the latest redis code, compile and install
wget http://redis.googlecode.com/files/ redis-2.4.15.tar.gz
tar -no-check-certificate http://
github
.com/nicolasff/phpredis/tarball/master -O phpredis.tar.gz
tar phpredis.tar.gz

cd nicolasff-phpredis-f1231c9

phpize
./configure --with-php-c/local/php/bin/php-configmake make install

4, modify php.ini, add redis.so module

vim /etc/php5/apache2/php.ini
vim /etc/php5/cli/php.ini
Add the following line

extension=redis.so

5, restart apache


/etc/init.d/apache restart

6, download the redis WEB management package

wget --no-check-certificate https://

github

.com/ErikDubbelboer/phpRedisAdmin/tarball/master -O phpRedisAdmin.tar.gz

tar xzvf phpRedisAdmin.tar.gz

mkdir /var/www/rediscp -fr ErikDubbelboer-phpRedisAdmin-9fcb29d/* /var/www/redis/

Open the browser and enter the following Address:

http://192.168.123.136/redis/

7, php test code

<?php
$redis = new Redis();
$redis->connect('127.0.0.1', 6379);
$redis->set('key', 'hello world');
echo $redis->get('key');
?>

The above introduces the installation of redisphp extension on ubuntu, including the github 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