zendopcache.sh 1.3 KB

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