Board logo

标题: [分享] memched正确食用指南 [打印本页]

作者: luqiqi    时间: 2016-4-8 11:25     标题: memched正确食用指南

  1. #!/bin/bash
  2. # Memcache install scripts
  3. # Author:wdlinux
  4. # Url http://www.wdlinux.cn

  5. echo "Select php version:
  6.     1 php-5.2.17 (default)
  7.     2 php-5.3.27
  8. "
  9. sleep 0.1
  10. read -p "Please Input 1,2: " PHP_VER_ID
  11. if [[ $PHP_VER_ID == 2 ]]; then
  12.     PHP_VER="5.3.27"
  13.     ext_dir="no-debug-non-zts-20090626"
  14. else
  15.     PHP_VER="5.2.17"
  16.     ext_dir="no-debug-zts-20060613"
  17. fi
  18. TOP=$(cd $(dirname $0)/.. && pwd)
  19. ###
  20. if [ ! -f /usr/bin/gcc ]; then
  21.     yum install -y gcc gcc-c++ make autoconf libtool-ltdl-devel \
  22.         gd-devel freetype-devel libxml2-devel libjpeg-devel \
  23.         libpng-devel openssl-devel curl-devel patch libmcrypt-devel \
  24.         libmhash-devel ncurses-devel sudo bzip2
  25. fi
  26. yum install -y zlib-devel

  27. ###
  28. cd /tmp
  29. wget -c http://dl.wdlinux.cn:5180/soft/libevent-1.4.14b-stable.tar.gz
  30. wget -c http://www.memcached.org/files/memcached-1.4.24.tar.gz
  31. wget -c http://pecl.php.net/get/memcache-2.2.7.tgz
  32. tar xf libevent-1.4.14b-stable.tar.gz
  33. cd libevent-1.4.14b-stable
  34. ./configure --prefix=/usr
  35. make
  36. [ $? != 0 ] && exit
  37. make install
  38. cd ..

  39. tar xf memcached-1.4.24.tar.gz
  40. cd memcached-1.4.24
  41. ./configure --prefix=/www/wdlinux/memcached --with-libevent=/usr
  42. make
  43. [ $? != 0 ] && exit
  44. make install
  45. cd ..

  46. if grep -qi 'debian\|ubuntu' /etc/issue; then
  47.     wget http://www.wdlinux.cn/conf/init.d/init.memcached-ubuntu -O /www/wdlinux/init.d/memcached
  48.     chmod 755 /www/wdlinux/init.d/memcached
  49.     ln -s /www/wdlinux/init.d/memcached /etc/init.d/memcached
  50.     update-rc.d -f memcached defaults
  51.     update-rc.d -f memcached enable 235
  52. else
  53.     wget http://www.wdlinux.cn/conf/init.d/init.memcached -O /www/wdlinux/init.d/memcached
  54.     chmod 755 /www/wdlinux/init.d/memcached
  55.     ln -s /www/wdlinux/init.d/memcached /etc/init.d/memcached
  56.     chkconfig --level 35 memcached on
  57. fi
  58. touch /www/wdlinux/etc/memcached.conf
  59. service memcached start

  60. ###
  61. tar zxvf memcache-2.2.7.tgz
  62. cd memcache-2.2.7
  63. /www/wdlinux/php/bin/phpize
  64. ./configure --enable-memcache --with-php-config=/www/wdlinux/php/bin/php-config --with-zlib-dir
  65. make
  66. [ $? != 0 ] && exit
  67. make install

  68. grep -q 'memcache.so' /www/wdlinux/etc/php.ini
  69. if [ $? != 0 ]; then
  70.     echo "
  71. [memcache]
  72. extension_dir ="/www/wdlinux/php/lib/php/extensions/$ext_dir"
  73. extension=memcache.so" >> /www/wdlinux/etc/php.ini
  74. fi

  75. if [ -d /www/wdlinux/apache ]; then
  76.     service httpd restart
  77. else
  78.     service nginxd restart
  79. fi

  80. echo
  81. echo "memcache install is OK"
  82. echo
复制代码


修改了第二个包的地址,保存为memcached.sh,一定行
作者: admin    时间: 2016-4-8 13:07

很好




欢迎光临 WDlinux官方论坛 (http://www.wdlinux.cn/bbs/) Powered by Discuz! 7.2