1
0

xcache.sh 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. #!/bin/bash
  2. # Author: yeho <lj2007331 AT gmail.com>
  3. # BLOG: https://blog.linuxeye.cn
  4. #
  5. # Notes: OneinStack for CentOS/RadHat 6+ Debian 6+ and Ubuntu 12+
  6. #
  7. # Project home page:
  8. # https://oneinstack.com
  9. # https://github.com/lj2007331/oneinstack
  10. Install_XCache() {
  11. pushd ${oneinstack_dir}/src > /dev/null
  12. phpExtensionDir=$(${php_install_dir}/bin/php-config --extension-dir)
  13. tar xzf xcache-${xcache_ver}.tar.gz
  14. pushd xcache-${xcache_ver}
  15. ${php_install_dir}/bin/phpize
  16. ./configure --enable-xcache --enable-xcache-coverager --enable-xcache-optimizer --with-php-config=${php_install_dir}/bin/php-config
  17. make -j ${THREAD} && make install
  18. if [ -f "${phpExtensionDir}/xcache.so" ]; then
  19. /bin/cp -R htdocs ${wwwroot_dir}/default/xcache
  20. popd
  21. chown -R ${run_user}.${run_user} ${wwwroot_dir}/default/xcache
  22. touch /tmp/xcache;chown ${run_user}.${run_user} /tmp/xcache
  23. let xcacheCount="${CPU}+1"
  24. let xcacheSize="${Memory_limit}/2"
  25. cat > ${php_install_dir}/etc/php.d/04-xcache.ini << EOF
  26. [xcache-common]
  27. extension=xcache.so
  28. [xcache.admin]
  29. xcache.admin.enable_auth=On
  30. xcache.admin.user=admin
  31. xcache.admin.pass="${xcachepwd_md5}"
  32. [xcache]
  33. xcache.size=${xcacheSize}M
  34. xcache.count=${xcacheCount}
  35. xcache.slots=8K
  36. xcache.ttl=3600
  37. xcache.gc_interval=300
  38. xcache.var_size=4M
  39. xcache.var_count=${xcacheCount}
  40. xcache.var_slots=8K
  41. xcache.var_ttl=0
  42. xcache.var_maxttl=0
  43. xcache.var_gc_interval=300
  44. xcache.test=Off
  45. xcache.readonly_protection=Off
  46. xcache.shm_scheme=mmap
  47. xcache.mmap_path=/tmp/xcache
  48. xcache.coredump_directory=
  49. xcache.cacher=On
  50. xcache.stat=On
  51. xcache.optimizer=Off
  52. [xcache.coverager]
  53. ; enabling this feature will impact performance
  54. ; enable only if xcache.coverager == On && xcache.coveragedump_directory == "non-empty-value"
  55. ; enable coverage data collecting and xcache_coverager_start/stop/get/clean() functions
  56. xcache.coverager = Off
  57. xcache.coverager_autostart = On
  58. xcache.coveragedump_directory = ""
  59. EOF
  60. echo "${CSUCCESS}Xcache module installed successfully! ${CEND}"
  61. rm -rf xcache-${xcache_ver}
  62. else
  63. echo "${CFAILURE}Xcache module install failed, Please contact the author! ${CEND}"
  64. fi
  65. popd
  66. }