eaccelerator-0.9.sh 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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_eAccelerator-0-9() {
  11. cd $oneinstack_dir/src
  12. src_url=https://github.com/downloads/eaccelerator/eaccelerator/eaccelerator-0.9.6.1.tar.bz2 && Download_src
  13. tar jxf eaccelerator-0.9.6.1.tar.bz2
  14. cd eaccelerator-0.9.6.1
  15. make clean
  16. $php_install_dir/bin/phpize
  17. ./configure --enable-eaccelerator=shared --with-php-config=$php_install_dir/bin/php-config
  18. make -j ${THREAD} && make install
  19. if [ -f "`$php_install_dir/bin/php-config --extension-dir`/eaccelerator.so" ];then
  20. mkdir /var/eaccelerator_cache;chown -R ${run_user}.$run_user /var/eaccelerator_cache
  21. cat > $php_install_dir/etc/php.d/ext-eaccelerator.ini << EOF
  22. [eaccelerator]
  23. zend_extension=`$php_install_dir/bin/php-config --extension-dir`/eaccelerator.so
  24. eaccelerator.shm_size=64
  25. eaccelerator.cache_dir=/var/eaccelerator_cache
  26. eaccelerator.enable=1
  27. eaccelerator.optimizer=1
  28. eaccelerator.check_mtime=1
  29. eaccelerator.debug=0
  30. eaccelerator.filter=
  31. eaccelerator.shm_max=0
  32. eaccelerator.shm_ttl=0
  33. eaccelerator.shm_prune_period=0
  34. eaccelerator.shm_only=0
  35. eaccelerator.compress=0
  36. eaccelerator.compress_level=9
  37. eaccelerator.keys=disk_only
  38. eaccelerator.sessions=disk_only
  39. eaccelerator.content=disk_only
  40. EOF
  41. echo "${CSUCCESS}Accelerator module installed successfully! ${CEND}"
  42. cd ..
  43. [ -z "`grep 'kernel.shmmax = 67108864' /etc/sysctl.conf`" ] && echo 'kernel.shmmax = 67108864' >> /etc/sysctl.conf
  44. sysctl -p
  45. [ "$Apache_version" != '1' -a "$Apache_version" != '2' ] && service php-fpm restart || service httpd restart
  46. else
  47. echo "${CFAILURE}Accelerator module install failed, Please contact the author! ${CEND}"
  48. fi
  49. cd ..
  50. }