apcu.sh 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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. # https://oneinstack.com
  9. # https://github.com/lj2007331/oneinstack
  10. Install_APCU() {
  11. pushd ${oneinstack_dir}/src
  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_version}.tgz
  15. pushd apcu-${apcu_for_php7_version}
  16. else
  17. tar xzf apcu-${apcu_version}.tgz
  18. pushd apcu-${apcu_version}
  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/ext-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. [ "${Apache_version}" != '1' -a "${Apache_version}" != '2' ] && service php-fpm restart || service httpd restart
  33. /bin/cp apc.php ${wwwroot_dir}/default
  34. echo "${CSUCCESS}APCU module installed successfully! ${CEND}"
  35. else
  36. echo "${CFAILURE}APCU module install failed, Please contact the author! ${CEND}"
  37. fi
  38. popd
  39. rm -rf apcu-${apcu_version}
  40. popd
  41. }