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. {
  12. cd $oneinstack_dir/src
  13. src_url=http://pecl.php.net/get/apcu-$apcu_version.tgz && Download_src
  14. tar xzf apcu-$apcu_version.tgz
  15. cd apcu-$apcu_version
  16. make clean
  17. $php_install_dir/bin/phpize
  18. ./configure --with-php-config=$php_install_dir/bin/php-config
  19. make && make install
  20. if [ -f "$php_install_dir/lib/php/extensions/`ls $php_install_dir/lib/php/extensions | grep zts`/apcu.so" ];then
  21. cat >> $php_install_dir/etc/php.ini << EOF
  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. }