永久黄网站色视频免费直播,yy6080三理论日本中文,亚洲无码免费在线观看视频,欧美日韩精品一区二区在线播放

Board logo

標(biāo)題: [教程] wdcp v3安裝redis及添加phpredis擴(kuò)展 [打印本頁(yè)]

作者: winran    時(shí)間: 2017-1-12 09:55     標(biāo)題: wdcp v3安裝redis及添加phpredis擴(kuò)展

本帖最后由 winran 于 2017-1-12 09:58 編輯

安裝時(shí),請(qǐng)注意替換成自己服務(wù)器的路徑地址!




一、安裝redis

a、下載redis:

  

wget   http://download.redis.io/redis-stable.tar.gz

  

tar  -zxvf redis-stable.tar.gz

  

cd  redis-stable

  

make

  

make  install

  
  

b、在redis安裝目錄下進(jìn)入utils目錄,執(zhí)行自動(dòng)安裝腳本

  

cd  utils/

  

./install_server.sh

  

一路回車都按照默認(rèn)設(shè)置執(zhí)行

  

//執(zhí)行完腳本后,會(huì)出現(xiàn)以下提示:

  

Selected  config:

  

Port            : 6379

  

Config  file    : /etc/redis/6379.conf

  

Log  file       : /var/log/redis_6379.log

  

Data  dir       : /var/lib/redis/6379

  

Executable      : /usr/local/bin/redis-server

  

Cli  Executable : /usr/local/bin/redis-cli

  
  

c、添加redis開(kāi)機(jī)自啟動(dòng)

  

//修改文件權(quán)限

  

chmod  755 /etc/init.d/redis_6379

  

//添加自啟動(dòng)

  

chkconfig  --add redis_6379

  

chkconfig  --level 345 redis_6379 on

  
  

d、檢查遠(yuǎn)程服務(wù)器的6379端口是否被防火墻攔截。假如未開(kāi)啟,則開(kāi)添加

  

/sbin/iptables  -I INPUT -p tcp --dport 6379 -j ACCEPT

  

/etc/init.d/iptables  restart(視服務(wù)器情況而定,如果不知道的話可以選擇重啟服務(wù)器)

  

也可以在wdcp的后臺(tái)系統(tǒng)管理--iptables添加規(guī)則

  

使用安騎士等防火墻軟件的自行添加6379端口訪問(wèn)通過(guò)的規(guī)則

  
  

e、編輯redis配置文件,允許所有ip連接

  

vim  /etc/redis/6379.conf

  

//找到bind 127.0.0.1這一行,替換成下面這行內(nèi)容

  

bind  0.0.0.0

  

保存退出

  

重啟使配置生效:/etc/init.d/redis_6379  restart

  
  

f、通過(guò)客戶端命令行連接redis


  

//在本地連接

  

redis-cli  -h 127.0.0.1 -p 6379

  
  

二、添加phpredis擴(kuò)展

  

獲取并解壓安裝包

  

cd

  

wget   https://github.com/phpredis/phpredis/archive/develop.zip

  

unzip  develop.zip

  

注意:若提示未找到“unzip”命令

  

解決辦法:運(yùn)行    yum install unzip -y

  

//進(jìn)入目錄

  

cd  phpredis-develop

  

使用phpize命令添加擴(kuò)展,phpize命令所在路徑根據(jù)實(shí)際情況修改

  

/www/wdlinux/nginx_php/bin/phpize

  

注意:可能會(huì)有“Cannot find  autoconf. Please check your autoconf installation and the $PHP_AUTOCONF  environment variable. Then, rerun this script.”錯(cuò)誤

  

解決辦法:運(yùn)行 yum install  -y autoconf

  

再重新運(yùn)行前面的phpize命令

  

出現(xiàn)類似下圖的提示,則代表成功

  

  


  

  

//配置。php-config命令所在路徑根據(jù)實(shí)際情況修改

  

./configure  --with-php-config= /www/wdlinux/apache_php-5.4.38/bin/php-config

  

出現(xiàn)類似下面的內(nèi)容,說(shuō)明此步驟沒(méi)問(wèn)題

  
  

安裝

  

make

  

出現(xiàn)類似下圖,說(shuō)明此步驟成功:

  

  

make install

  

出現(xiàn)類似下面的內(nèi)容,說(shuō)明成功:

  

  

代表生成redis.so成功,可以進(jìn)到該目錄去查看是否有生成。該路徑也是視實(shí)際情況而定。

  

//php.ini中加入redis.so擴(kuò)展

  

vim   /www/wdlinux/nginx_php/etc/php.ini

  

//加入這一行,保存退出。路徑要使用上面裝完redis生成redis.so的路徑

  

extension=/www/wdlinux/nginx_php /lib/php/extensions/no-debug-non-zts-20121212/redis.so

  

重啟web服務(wù)(重點(diǎn)是重啟php)

  

通過(guò)phpinfo查看是否添加了redis擴(kuò)展

  


(額外幫助信息)啟動(dòng)/關(guān)閉服務(wù)命令

  

//查看是否啟動(dòng)redis服務(wù)

  

ps  -ef | grep redis

  

//啟動(dòng)

  

//etc/init.d/redis_6379   start

  

//通過(guò)配置文件啟動(dòng)

  

//usr/local/bin/redis-server   /etc/redis/6379.conf

  

//關(guān)閉

  

//etc/init.d/redis_6379   stop

  

//關(guān)閉,假如是默認(rèn)端口號(hào)6379,可以省略 -p 6379參數(shù)

  

//usr/local/bin/redis-cli  -p 6379 shutdown

  
  
  

作者: lanyeit    時(shí)間: 2017-1-12 11:00

:)
作者: howku    時(shí)間: 2017-1-12 16:53

很好的文章,一直在期待有redis的安裝教程。
作者: bluegua    時(shí)間: 2017-1-18 02:00

這個(gè)是有挖礦漏洞的,請(qǐng)大家不要安裝,或者給加固
作者: Terabyte    時(shí)間: 2017-2-6 13:16

在步驟a編譯過(guò)程中,如果出現(xiàn)錯(cuò)誤:
../deps/jemalloc/lib/libjemalloc.a(nstime.o): In function nstime_get': /opt/redis_src/current/redis-stable/deps/jemalloc/src/nstime.c:120: undefined reference toclock_gettime'

在以下文件redis-stable\src\Makefile中這一行的最后加入 -lrt,即
FINAL_LIBS+= ../deps/jemalloc/lib/libjemalloc.a -lrt

重新編譯即可。
問(wèn)題參考:
https://github.com/antirez/redis/issues/3790
作者: skyuser    時(shí)間: 2017-2-13 23:37

本帖最后由 skyuser 于 2017-2-13 23:38 編輯

二、添加phpredis擴(kuò)展

  1. /www/wdlinux/apache_php-5.6.29/bin/phpize


  2. ./configure --with-php-config= /www/wdlinux/apache_php-5.6.29/bin/php-config
復(fù)制代碼





配置php-config的時(shí)候報(bào)錯(cuò) 能幫我看看是怎么回事嗎?

checking build system type... Invalid configuration `/www/wdlinux/apache_php-5.6.29/bin/php-config': machine `/www/wdlinux/apache_php-5.6.29/bin/php' not recognized
configure: error: /bin/sh ./config.sub /www/wdlinux/apache_php-5.6.29/bin/php-config failed
作者: aming511    時(shí)間: 2017-2-16 23:26

請(qǐng)問(wèn),為什么我執(zhí)行到第二步同make 就不能進(jìn)行了呢?  make: *** No targets specified and no makefile found.  Stop.    提示這個(gè)~~  第一步的一切正常。
作者: aming511    時(shí)間: 2017-2-20 09:30

我的也是樓上一樣的問(wèn)題,請(qǐng)問(wèn)怎么解決呢~~~~  :'( :'( :'(
作者: aming511    時(shí)間: 2017-2-20 09:31

二、添加phpredis擴(kuò)展






配置php-config的時(shí)候報(bào)錯(cuò) 能幫我看看是怎么回事嗎?

checking buil ...
skyuser 發(fā)表于 2017-2-13 23:37

你解決了嘛?  我也卡在這里呢。
作者: Terabyte    時(shí)間: 2017-2-21 23:35

回復(fù) 4# bluegua


   請(qǐng)教一下怎么防止這個(gè)呢? 謝謝
作者: Terabyte    時(shí)間: 2017-2-23 15:30

回復(fù) 6# skyuser


看起來(lái)是PHP的安裝目錄路徑不對(duì)。
仔細(xì)看看具體路徑,替換一下。
作者: Terabyte    時(shí)間: 2017-2-23 15:39

請(qǐng)大家注意, 安裝Redis的時(shí)候千萬(wàn)要設(shè)置密碼,最好是缺省端口也改一改。因?yàn)镽edis本身的漏洞,不設(shè)置的話會(huì)被掃描而種入病毒、木馬。

對(duì)于樓主在步驟e寫(xiě)的:
--------------------------------------------------------
im  /etc/redis/6379.conf
//找到bind 127.0.0.1這一行,替換成下面這行內(nèi)容
bind  0.0.0.0

--------------------------------------------------------
請(qǐng)一定一定一定要謹(jǐn)慎,如果只是本機(jī)調(diào)用,建議改成bind 127.0.0.1即可
同時(shí)一定一定一定要在大約481行設(shè)置:
requirepass 你的密碼

如果突然CPU長(zhǎng)時(shí)間接近100%,而且查看進(jìn)程發(fā)現(xiàn)有類似這些進(jìn)程:
AnXqV, ddg.219, ddg.212, minerd

再看看這些目錄下是不是多了東西:/opt, /tmp,/var/spool/cron, /etc/rc.d/

那么恭喜你中獎(jiǎng)了, 服務(wù)器已經(jīng)淪為挖礦肉雞。
作者: aming511    時(shí)間: 2017-2-24 16:40

本帖最后由 aming511 于 2017-2-24 16:58 編輯

回復(fù) 11# Terabyte


   我配置也出現(xiàn)同樣的問(wèn)題, 確定過(guò)目錄啊。可還是不對(duì)啊。
checking build system type... Invalid configuration `/www/wdlinux/nginx_php-5.6.29/bin/php-config': machine `/www/wdlinux/nginx_php-5.6.29/bin/php' not recognized
configure: error: /bin/sh ./config.sub /www/wdlinux/nginx_php-5.6.29/bin/php-config failed
作者: winran    時(shí)間: 2017-2-26 17:31

本帖最后由 winran 于 2017-2-26 17:34 編輯

最新穩(wěn)定版下載redis:
  
wget   http://download.redis.io/releases/redis-3.2.8.tar.gz
  
tar  -zxvf redis-3.2.8.tar.gz
  
cd  redis-3.2.8
  
make
  
make  install
作者: zyojl    時(shí)間: 2017-4-25 19:44

回復(fù) 7# aming511


   我進(jìn)入桌面環(huán)境運(yùn)行就正常了!
作者: eesso    時(shí)間: 2017-8-27 14:16

真的價(jià)格真的價(jià)格
作者: syq10086    時(shí)間: 2017-10-13 00:20

回復(fù) 1# winran


  
  1. [root@iZ25x4ajoqbZ phpredis-develop]# /www/wdlinux/php/bin/phpize
  2. Configuring for:
  3. PHP Api Version:         20090626
  4. Zend Module Api No:      20090626
  5. Zend Extension Api No:   220090626
  6. [root@iZ25x4ajoqbZ phpredis-develop]# ./configure    --with-php-config=/www/wdlinux/apache_php-5.5.38/bin/php-config
  7. checking for grep that handles long lines and -e... /bin/grep
  8. checking for egrep... /bin/grep -E
  9. checking for a sed that does not truncate output... /bin/sed
  10. checking for cc... cc
  11. checking for C compiler default output file name... a.out
  12. checking whether the C compiler works... yes
  13. checking whether we are cross compiling... no
  14. checking for suffix of executables...
  15. checking for suffix of object files... o
  16. checking whether we are using the GNU C compiler... yes
  17. checking whether cc accepts -g... yes
  18. checking for cc option to accept ISO C89... none needed
  19. checking how to run the C preprocessor... cc -E
  20. checking for icc... no
  21. checking for suncc... no
  22. checking whether cc understands -c and -o together... yes
  23. checking for system library directory... lib
  24. checking if compiler supports -R... no
  25. checking if compiler supports -Wl,-rpath,... yes
  26. checking build system type... x86_64-unknown-linux-gnu
  27. checking host system type... x86_64-unknown-linux-gnu
  28. checking target system type... x86_64-unknown-linux-gnu
  29. configure: error: Cannot find php-config. Please use --with-php-config=PATH
  30. [root@iZ25x4ajoqbZ phpredis-develop]# ./configure --with-php-config=/www/wdlinux/nginx_php-5.2.17/bin/php-config
  31. checking for grep that handles long lines and -e... /bin/grep
  32. checking for egrep... /bin/grep -E
  33. checking for a sed that does not truncate output... /bin/sed
  34. checking for cc... cc
  35. checking for C compiler default output file name... a.out
  36. checking whether the C compiler works... yes
  37. checking whether we are cross compiling... no
  38. checking for suffix of executables...
  39. checking for suffix of object files... o
  40. checking whether we are using the GNU C compiler... yes
  41. checking whether cc accepts -g... yes
  42. checking for cc option to accept ISO C89... none needed
  43. checking how to run the C preprocessor... cc -E
  44. checking for icc... no
  45. checking for suncc... no
  46. checking whether cc understands -c and -o together... yes
  47. checking for system library directory... lib
  48. checking if compiler supports -R... no
  49. checking if compiler supports -Wl,-rpath,... yes
  50. checking build system type... x86_64-unknown-linux-gnu
  51. checking host system type... x86_64-unknown-linux-gnu
  52. checking target system type... x86_64-unknown-linux-gnu
  53. checking for PHP prefix... /www/wdlinux/nginx_php-5.2.17
  54. checking for PHP includes... -I/www/wdlinux/nginx_php-5.2.17/include/php -I/www/wdlinux/nginx_php-5.2.17/include/php/main -I/www/wdlinux/nginx_php-5.2.17/include/php/TSRM -I/www/wdlinux/nginx_php-5.2.17/include/php/Zend -I/www/wdlinux/nginx_php-5.2.17/include/php/ext -I/www/wdlinux/nginx_php-5.2.17/include/php/ext/date/lib
  55. checking for PHP extension directory... /www/wdlinux/nginx_php-5.2.17/lib/php/extensions/no-debug-non-zts-20060613
  56. checking for PHP installed headers prefix... /www/wdlinux/nginx_php-5.2.17/include/php
  57. checking if debug is enabled... no
  58. checking if zts is enabled... no
  59. checking for re2c... no
  60. configure: WARNING: You will need re2c 0.13.4 or later if you want to regenerate PHP parsers.
  61. checking for gawk... gawk
  62. checking whether to enable redis support... yes, shared
  63. checking whether to enable sessions... yes
  64. checking whether to enable igbinary serializer support... no
  65. checking for redis igbinary support... disabled
  66. checking for ld used by cc... /usr/bin/ld
  67. checking if the linker (/usr/bin/ld) is GNU ld... yes
  68. checking for /usr/bin/ld option to reload object files... -r
  69. checking for BSD-compatible nm... /usr/bin/nm -B
  70. checking whether ln -s works... yes
  71. checking how to recognize dependent libraries... pass_all
  72. checking for ANSI C header files... yes
  73. checking for sys/types.h... yes
  74. checking for sys/stat.h... yes
  75. checking for stdlib.h... yes
  76. checking for string.h... yes
  77. checking for memory.h... yes
  78. checking for strings.h... yes
  79. checking for inttypes.h... yes
  80. checking for stdint.h... yes
  81. checking for unistd.h... yes
  82. checking dlfcn.h usability... yes
  83. checking dlfcn.h presence... yes
  84. checking for dlfcn.h... yes
  85. checking the maximum length of command line arguments... 1966080
  86. checking command to parse /usr/bin/nm -B output from cc object... ok
  87. checking for objdir... .libs
  88. checking for ar... ar
  89. checking for ranlib... ranlib
  90. checking for strip... strip
  91. checking if cc supports -fno-rtti -fno-exceptions... no
  92. checking for cc option to produce PIC... -fPIC
  93. checking if cc PIC flag -fPIC works... yes
  94. checking if cc static flag -static works... no
  95. checking if cc supports -c -o file.o... yes
  96. checking whether the cc linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
  97. checking whether -lc should be explicitly linked in... no
  98. checking dynamic linker characteristics... GNU/Linux ld.so
  99. checking how to hardcode library paths into programs... immediate
  100. checking whether stripping libraries is possible... yes
  101. checking if libtool supports shared libraries... yes
  102. checking whether to build shared libraries... yes
  103. checking whether to build static libraries... no

  104. creating libtool
  105. appending configuration tag "CXX" to libtool
  106. configure: creating ./config.status
  107. config.status: creating config.h
  108. [root@iZ25x4ajoqbZ phpredis-develop]# make
  109. /bin/sh /root/phpredis-develop/libtool --mode=compile cc  -I. -I/root/phpredis-develop -DPHP_ATOM_INC -I/root/phpredis-develop/include -I/root/phpredis-develop/main -I/root/phpredis-develop -I/www/wdlinux/nginx_php-5.2.17/include/php -I/www/wdlinux/nginx_php-5.2.17/include/php/main -I/www/wdlinux/nginx_php-5.2.17/include/php/TSRM -I/www/wdlinux/nginx_php-5.2.17/include/php/Zend -I/www/wdlinux/nginx_php-5.2.17/include/php/ext -I/www/wdlinux/nginx_php-5.2.17/include/php/ext/date/lib  -DHAVE_CONFIG_H  -g -O2   -c /root/phpredis-develop/redis.c -o redis.lo
  110. mkdir .libs
  111. cc -I. -I/root/phpredis-develop -DPHP_ATOM_INC -I/root/phpredis-develop/include -I/root/phpredis-develop/main -I/root/phpredis-develop -I/www/wdlinux/nginx_php-5.2.17/include/php -I/www/wdlinux/nginx_php-5.2.17/include/php/main -I/www/wdlinux/nginx_php-5.2.17/include/php/TSRM -I/www/wdlinux/nginx_php-5.2.17/include/php/Zend -I/www/wdlinux/nginx_php-5.2.17/include/php/ext -I/www/wdlinux/nginx_php-5.2.17/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /root/phpredis-develop/redis.c  -fPIC -DPIC -o .libs/redis.o
  112. env: cc: Permission denied
  113. make: *** [redis.lo] Error 1
  114. [root@iZ25x4ajoqbZ phpredis-develop]# make install
  115. /bin/sh /root/phpredis-develop/libtool --mode=compile cc  -I. -I/root/phpredis-develop -DPHP_ATOM_INC -I/root/phpredis-develop/include -I/root/phpredis-develop/main -I/root/phpredis-develop -I/www/wdlinux/nginx_php-5.2.17/include/php -I/www/wdlinux/nginx_php-5.2.17/include/php/main -I/www/wdlinux/nginx_php-5.2.17/include/php/TSRM -I/www/wdlinux/nginx_php-5.2.17/include/php/Zend -I/www/wdlinux/nginx_php-5.2.17/include/php/ext -I/www/wdlinux/nginx_php-5.2.17/include/php/ext/date/lib  -DHAVE_CONFIG_H  -g -O2   -c /root/phpredis-develop/redis.c -o redis.lo
  116. cc -I. -I/root/phpredis-develop -DPHP_ATOM_INC -I/root/phpredis-develop/include -I/root/phpredis-develop/main -I/root/phpredis-develop -I/www/wdlinux/nginx_php-5.2.17/include/php -I/www/wdlinux/nginx_php-5.2.17/include/php/main -I/www/wdlinux/nginx_php-5.2.17/include/php/TSRM -I/www/wdlinux/nginx_php-5.2.17/include/php/Zend -I/www/wdlinux/nginx_php-5.2.17/include/php/ext -I/www/wdlinux/nginx_php-5.2.17/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /root/phpredis-develop/redis.c  -fPIC -DPIC -o .libs/redis.o
  117. env: cc: Permission denied
  118. make: *** [redis.lo] Error 1
  119. [root@iZ25x4ajoqbZ phpredis-develop]#
復(fù)制代碼

make失敗,怎么回事
作者: jianlinsoft    時(shí)間: 2018-1-12 18:47

關(guān)于該步出錯(cuò)的原因.請(qǐng)大家對(duì)應(yīng)修改.就好了
未命名-1.fw.png

圖片附件: 未命名-1.fw.png (2018-1-12 18:46, 101.7 KB) / 下載次數(shù) 242764
http://www.fsowen.com/bbs/attachment.php?aid=8313&k=1a8b33fd297316d228c540d19d698c02&t=1744213549&sid=LlV6Tj






歡迎光臨 WDlinux官方論壇 (http://www.fsowen.com/bbs/) Powered by Discuz! 7.2