1
0

zendopcache.sh 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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_ZendOPcache()
  11. {
  12. cd $oneinstack_dir/src
  13. src_url=https://pecl.php.net/get/zendopcache-$zendopcache_version.tgz && Download_src
  14. tar xzf zendopcache-$zendopcache_version.tgz
  15. cd zendopcache-$zendopcache_version
  16. make clean
  17. $php_install_dir/bin/phpize
  18. ./configure --with-php-config=$php_install_dir/bin/php-config
  19. make -j ${THREAD} && make install
  20. if [ -f "`$php_install_dir/bin/php-config --extension-dir`/opcache.so" ];then
  21. cat > $php_install_dir/etc/php.d/ext-opcache.ini << EOF
  22. [opcache]
  23. zend_extension=`$php_install_dir/bin/php-config --extension-dir`/opcache.so
  24. opcache.enable=1
  25. opcache.memory_consumption=$Memory_limit
  26. opcache.interned_strings_buffer=8
  27. opcache.max_accelerated_files=4000
  28. opcache.revalidate_freq=60
  29. opcache.save_comments=0
  30. opcache.fast_shutdown=1
  31. opcache.enable_cli=1
  32. ;opcache.optimization_level=0
  33. EOF
  34. echo "${CSUCCESS}Zend OPcache module install successfully! ${CEND}"
  35. cd ..
  36. rm -rf zendopcache-$zendopcache_version
  37. [ "$Apache_version" != '1' -a "$Apache_version" != '2' ] && service php-fpm restart || service httpd restart
  38. else
  39. echo "${CFAILURE}Zend OPcache module install failed, Please contact the author! ${CEND}"
  40. fi
  41. cd ..
  42. }