pecl_imap.sh 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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_imap() {
  11. if [ -e "${php_install_dir}/bin/phpize" ]; then
  12. pushd ${oneinstack_dir}/src > /dev/null
  13. if [ "${PM}" == 'yum' ]; then
  14. yum -y install libc-client-devel
  15. [ ! -e /usr/lib/libc-client.so ] && ln -s /usr/lib64/libc-client.so /usr/lib/libc-client.so
  16. else
  17. apt-get -y install libc-client2007e-dev
  18. fi
  19. phpExtensionDir=$(${php_install_dir}/bin/php-config --extension-dir)
  20. PHP_detail_ver=$(${php_install_dir}/bin/php-config --version)
  21. src_url=https://secure.php.net/distributions/php-${PHP_detail_ver}.tar.gz && Download_src
  22. tar xzf php-${PHP_detail_ver}.tar.gz
  23. pushd php-${PHP_detail_ver}/ext/imap > /dev/null
  24. ${php_install_dir}/bin/phpize
  25. ./configure --with-php-config=${php_install_dir}/bin/php-config --with-kerberos --with-imap --with-imap-ssl
  26. make -j ${THREAD} && make install
  27. popd > /dev/null
  28. if [ -f "${phpExtensionDir}/imap.so" ]; then
  29. echo 'extension=imap.so' > ${php_install_dir}/etc/php.d/04-imap.ini
  30. echo "${CSUCCESS}PHP imap module installed successfully! ${CEND}"
  31. rm -rf php-${PHP_detail_ver}
  32. else
  33. echo "${CFAILURE}PHP imap module install failed, Please contact the author! ${CEND}" && grep -Ew 'NAME|ID|ID_LIKE|VERSION_ID|PRETTY_NAME' /etc/os-release
  34. fi
  35. popd > /dev/null
  36. fi
  37. }
  38. Uninstall_pecl_imap() {
  39. if [ -e "${php_install_dir}/etc/php.d/04-imap.ini" ]; then
  40. rm -f ${php_install_dir}/etc/php.d/04-imap.ini
  41. echo; echo "${CMSG}PHP imap module uninstall completed${CEND}"
  42. else
  43. echo; echo "${CWARNING}PHP imap module does not exist! ${CEND}"
  44. fi
  45. }