centos6.4安裝redis和phpredis記錄

來源:互聯網
上載者:User

一、redis

1.下載安裝

$ wget http://download.redis.io/releases/redis-2.6.16$ tar xzf redis-2.6.16$ cd redis-2.6.16$ make install

 

2.配置

$ mkdir /etc/$ cp redis.conf /etc/redis/$ gedit /etc/sysctl.conf$ sysctl -p

註:sysctl.conf檔案尾部加上vm.overcommit_memory=1

 

3.啟動測試

$ /usr/local/bin/redis-server /etc/redis/$ /usr/local/bin/redis-$$ get test

 

4.開機啟動

$ gedit /etc/redis/redis.conf

設定daemonize yes

 

$ gedit /var/run/redis.pid

直接儲存,主要是建立該檔案

 

gedit /etc/init.d/redis

編輯指令碼,也可以自己下載或者輸入以下內容

/etc/init.d/===[ -r  ] && source =0== [ -e 1-n $/ =$?  0 ] && touch /var/lock/subsys/         -n $=$?  0 ] && rm  /var/lock/subsys/           -e /var/lock/subsys/ ] &&=$?=$?*$=1

 

$ chmod 755 /etc/init.d/redis

改變檔案許可權

 

$ chkconfig --$ chkconfig --level 345$ chkconfig --list redis 

添加開機啟動

 

之後重啟伺服器,$ service redis status 查看是否正確配置

 

二、phpredis

1.自行下載解壓

https://github.com/nicolasff/phpredis/archive/master.zip

 

2.安裝

$ cd /root/phpredis-$ /usr/local/php/bin/$ ./configure --with-php-config=/usr/local/php/bin/php-$ make && make install

註:路徑根據實際情況修改

 

3.php擴充

$ gedit /usr/local/php/etc/php.ini

加入extension=redis.so,然後重啟php-fpm(非nginx)

 

4.測試

 = ->connect('127.0.0.1',6379->set('test','hello world!' ->get('test');

 

三、phpredisadmin

http://down.admin5.com/php/75024.html

下載解壓至www目錄即可,最好不用官方最新版本。

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.