apcu.sh 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. #!/bin/bash
  2. # Author: yeho <lj2007331 AT gmail.com>
  3. # BLOG: https://blog.linuxeye.com
  4. #
  5. # Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+
  6. #
  7. # Project home page:
  8. # http://oneinstack.com
  9. # https://github.com/lj2007331/oneinstack
  10. Install_APCU() {
  11. cd $oneinstack_dir/src
  12. src_url=http://pecl.php.net/get/apcu-$apcu_version.tgz && Download_src
  13. tar xzf apcu-$apcu_version.tgz
  14. cd apcu-$apcu_version
  15. make clean
  16. $php_install_dir/bin/phpize
  17. ./configure --with-php-config=$php_install_dir/bin/php-config
  18. make && make install
  19. if [ -f "`$php_install_dir/bin/php-config --extension-dir`/apcu.so" ];then
  20. cat > $php_install_dir/etc/php.d/ext-apcu.ini << EOF
  21. [apcu]
  22. extension=apcu.so
  23. apc.enabled=1
  24. apc.shm_size=32M
  25. apc.ttl=7200
  26. apc.enable_cli=1
  27. EOF
  28. [ "$Apache_version" != '1' -a "$Apache_version" != '2' ] && service php-fpm restart || service httpd restart
  29. /bin/cp apc.php $wwwroot_dir/default
  30. echo "${CSUCCESS}APCU module install successfully! ${CEND}"
  31. cd ..
  32. rm -rf apcu-$apcu_version
  33. else
  34. echo "${CFAILURE}APCU module install failed, Please contact the author! ${CEND}"
  35. fi
  36. cd ..
  37. }