1
0

apcu.sh 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  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_APCU() {
  11. pushd ${oneinstack_dir}/src > /dev/null
  12. phpExtensionDir=`${php_install_dir}/bin/php-config --extension-dir`
  13. if [ "`${php_install_dir}/bin/php -r 'echo PHP_VERSION;' | awk -F. '{print $1}'`" == '7' ]; then
  14. tar xzf apcu-${apcu_for_php7_ver}.tgz
  15. pushd apcu-${apcu_for_php7_ver}
  16. else
  17. tar xzf apcu-${apcu_ver}.tgz
  18. pushd apcu-${apcu_ver}
  19. fi
  20. ${php_install_dir}/bin/phpize
  21. ./configure --with-php-config=${php_install_dir}/bin/php-config
  22. make -j ${THREAD} && make install
  23. if [ -f "${phpExtensionDir}/apcu.so" ]; then
  24. cat > ${php_install_dir}/etc/php.d/02-apcu.ini << EOF
  25. [apcu]
  26. extension=apcu.so
  27. apc.enabled=1
  28. apc.shm_size=32M
  29. apc.ttl=7200
  30. apc.enable_cli=1
  31. EOF
  32. /bin/cp apc.php ${wwwroot_dir}/default
  33. echo "${CSUCCESS}APCU module installed successfully! ${CEND}"
  34. popd
  35. rm -rf apcu-${apcu_for_php7_ver} apcu-${apcu_ver} package.xml
  36. else
  37. echo "${CFAILURE}APCU module install failed, Please contact the author! ${CEND}"
  38. fi
  39. popd
  40. }