安装redis和phpredis模块
@ubuntu:/$?redis> get foo
@ubuntu:/$?"bar";?
裝了redis的服務(wù)器端程序,現(xiàn)在要在項(xiàng)目中使用REDIS了,由于我們的后臺(tái)是用PHP來(lái)寫的,所以要用redis的PHP客戶端來(lái)使用它。PHP的客戶端有幾種:
| Predis?★ | Repository | JoL1hAHN | Mature and supported |
| phpredis?★ | Repository | yowgi | This is a client written in C as a PHP module. |
| Rediska | Repository?Homepage | shumkov | ? |
| Redisent | Repository | justinpoliey | ? |
| iRedis | Repository | dhorrigan |
在這里我選擇phpredis( C開(kāi)發(fā)的擴(kuò)展包?)這個(gè)PHP擴(kuò)展。
@ubuntu:/$?wget?https://download.github.com/owlient-phpredis-2.1.1-1-g90ecd17.tar.gz?
@ubuntu:/$?tar zxvf owlient-phpredis-2.1.1-1-g90ecd17.tar.gz?
@ubuntu:/$?cd owlient-phpredis-90ecd17/?
@ubuntu:/$?/usr/local/php/bin/phpize?
@ubuntu:/$?./configure --with-php-config=/usr/local/php/bin/php-config?
@ubuntu:/$?make?
@ubuntu:/$?make install?
注:用C開(kāi)發(fā)PHP擴(kuò)展的時(shí)候如果用動(dòng)態(tài)鏈接庫(kù)的方式編譯擴(kuò)展模塊,需要用到phpize,這個(gè)工具在使用apt-get install php5默認(rèn)情況也是沒(méi)安裝的,安裝phpize:apt-get install php5-dev。??
?
修改配置文件:
修改php.ini文件???
在php.ini中添加如下一行:
extension=redis.so
重啟nginx后生效。
?
最后開(kāi)啟redis服務(wù):redis-server 或者 redis-server /etc/redis.conf(后臺(tái)運(yùn)行),?
如果不開(kāi)服務(wù)可能會(huì)出現(xiàn)?”Uncaught exception 'RedisException' with message 'Redis server went away'?“錯(cuò)誤?
轉(zhuǎn)載于:https://www.cnblogs.com/jiangyao/archive/2012/09/19/2693221.html
總結(jié)
以上是生活随笔為你收集整理的安装redis和phpredis模块的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: div下图片自适应解决方法
- 下一篇: 动态规划算法php,php算法学习之动态