1c7 / VideoList

:us: -> :cn: @糖醋陈皮 翻译的视频列表
https://weibo.com/2004104451
57 stars 11 forks source link

phpredis 安装 #51

Open 1c7 opened 9 years ago

1c7 commented 9 years ago

phpredis 是一个扩展, 安装之后 php 就可以和 redis 交互了。


环境:

Linux (Ubuntu 14.04 LTS) nginx


安装步骤:

  1. https://github.com/phpredis/phpredis
  2. 下载 解压 cd 进去(就是进去解压出来的那个文件夹里)
  3. phpize (注意不是phpsize,没有s)
  4. ./configure
  5. make
  6. make install (在这一步看到权限错误什么的就直接 sudo make install)
  7. 第七步在 github 那边的文档是这样说的: but you still need to enable the module in the PHP config file. To do so, either edit your php.ini or add a redis.ini file in /etc/php5/conf.d with the following contents: extension=redis.so

我这里没这个 /etc/php5/conf.d

image

所以我进 mods-available,新建了个文件叫 20-redis.ini。 然后里面只打了一句话 extention = redis.so

image

然后创建一个这个文件的快捷方式,扔到 fpm/con.d 文件夹里 image

第八步,重启 php

sudo service php5-fpm restart 我就是忘记重启了,调了半天怀疑自己哪里弄错了。浪费了时间


成功之后

image image


一些解释

sudo 的意思是 super user do


如果遇到问题,

多看看 phpinfo(); 比如你可以看看你的扩展目录是啥 image 确认下 redis.so 的确存在 image nautilus ./ 用图形模式打开当前目录 image