centos下redis安裝

來源:互聯網
上載者:User

標籤:

下載redis

http://www.redis.cn/download.html

下載php的redis擴充

https://github.com/phpredis/phpredis#installation

如redis官網上教程安裝redis

下載,解壓和安裝:$ wget http://download.redis.io/releases/redis-2.8.19.tar.gz$ tar xzf redis-2.8.19.tar.gz$ cd redis-2.8.19$ make編譯後的可執行檔在src目錄中,可以使用下面的命令運行Redis:$ src/redis-server你可以使用內建的用戶端串連Redis:$ src/redis-cliredis> set foo barOKredis> get foo"bar"

安裝phpredis

[[email protected] server]# lsmysql  mysql-5.6.21  nginx  nginx-1.4.4  php  php-5.5.7  phpredis  redis-2.8.19  redis-2.8.19.tar.gz[[email protected] server]# cd phpredis/[[email protected] phpredis]# lsarrays.markdown  config.w32  debian          library.h         package.xml      redis_array.c       redis_array_impl.h  redis_session.h  testscommon.h         COPYING     debian.control  mkdeb-apache2.sh  php_redis.h      redis_array.h       redis.c             rpmconfig.m4        CREDITS     library.c       mkdeb.sh          README.markdown  redis_array_impl.c  redis_session.c     serialize.list[[email protected] phpredis]# /alidata/server/php/bin/phpizeConfiguring for:PHP Api Version:         20121113Zend Module Api No:      20121212Zend Extension Api No:   220121212[[email protected] phpredis]# ./configure --with-php-config=/alidata/server/php/bin/php-config[[email protected] phpredis]# make [[email protected] phpredis]# make installInstalling shared extensions:     /alidata/server/php/lib/php/extensions/no-debug-non-zts-20121212/然後在php.ini裡添加extension=redis.so 

測試代碼

<?php    $redis = new Redis();    $redis->connect(‘127.0.0.1‘,6379);    $redis->set(‘helloredis‘,‘i am ok‘);    echo $redis->get(‘helloredis‘);?>

 

centos下redis安裝

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.