pecl_calendar.sh 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #!/bin/bash
  2. # Author: yeho <lj2007331 AT gmail.com>
  3. # BLOG: https://linuxeye.com
  4. #
  5. # Notes: OneinStack for CentOS/RedHat 7+ Debian 9+ and Ubuntu 16+
  6. #
  7. # Project home page:
  8. # https://oneinstack.com
  9. # https://github.com/oneinstack/oneinstack
  10. Install_pecl_calendar() {
  11. if [ -e "${php_install_dir}/bin/phpize" ]; then
  12. pushd ${oneinstack_dir}/src > /dev/null
  13. phpExtensionDir=$(${php_install_dir}/bin/php-config --extension-dir)
  14. PHP_detail_ver=$(${php_install_dir}/bin/php-config --version)
  15. src_url=https://secure.php.net/distributions/php-${PHP_detail_ver}.tar.gz && Download_src
  16. tar xzf php-${PHP_detail_ver}.tar.gz
  17. pushd php-${PHP_detail_ver}/ext/calendar > /dev/null
  18. ${php_install_dir}/bin/phpize
  19. ./configure --with-php-config=${php_install_dir}/bin/php-config
  20. make -j ${THREAD} && make install
  21. popd > /dev/null
  22. if [ -f "${phpExtensionDir}/calendar.so" ]; then
  23. echo 'extension=calendar.so' > ${php_install_dir}/etc/php.d/04-calendar.ini
  24. echo "${CSUCCESS}PHP calendar module installed successfully! ${CEND}"
  25. rm -rf php-${PHP_detail_ver}
  26. else
  27. echo "${CFAILURE}PHP calendar module install failed, Please contact the author! ${CEND}" && grep -Ew 'NAME|ID|ID_LIKE|VERSION_ID|PRETTY_NAME' /etc/os-release
  28. fi
  29. popd > /dev/null
  30. fi
  31. }
  32. Uninstall_pecl_calendar() {
  33. if [ -e "${php_install_dir}/etc/php.d/04-calendar.ini" ]; then
  34. rm -f ${php_install_dir}/etc/php.d/04-calendar.ini
  35. echo; echo "${CMSG}PHP calendar module uninstall completed${CEND}"
  36. else
  37. echo; echo "${CWARNING}PHP calendar module does not exist! ${CEND}"
  38. fi
  39. }