Redis的php擴充phpredis安裝小記

來源:互聯網
上載者:User

最近這段時間一直在搗鼓Redis,搗鼓了蠻長一段時間了,略有所感就記錄下來了。

老的文章在這裡:http://www.cnblogs.com/scotoma/archive/2010/12/05/1897067.html

這裡主要是寫Redis在PHP下的擴充,原來打算在生產環境下使用PHP 5.3.4 可是感覺PHP官方都不是很推薦使用PHP 5.3.*的功能,新的Zend Framework2.0 更是沒有咋繼續更新了,所以就退回到了 5.2.16了.

為什麼用Redis就不用說了,退回了5.2.16版本後就不打算繼續使用Predis了就上Redis的官網看了下,感覺改版很大,換了獨立的網域名稱了,由VMware支援後果然不一樣,新網域名稱如下:http://redis.io/

看了新的Tutorials發現非常不錯,推薦去看看:http://try.redis-db.com/

現在這裡主要講下phpredis擴充的安裝,這個擴充是C寫的,效能上看應該比Predis要好多了,安裝後用起來感覺不錯

安裝步驟如下:

1.download code :git clone https://github.com/owlient/phpredis.git
2.phpize
(if you use centos,u should use the full path
/usr/local/php/bin/phpize
)./configure
(if get error ,should change it to
 ./configure --with-php-config=/usr/local/php/bin/php-config
)make && make install
3.edit php.ini and add extension
extension=redis.so
4.restart u server
結果以上幾步安裝完成後就可以出現這個了,查看phpinfo

安裝完成後開始使用了

使用說明文檔在這裡:

https://github.com/owlient/phpredis

測試代碼在這裡:

dump:

string(11) “Hello world” string(9) “xinqiyang”

update:20110721

聯繫我們

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