pecl_phalcon.sh 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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_phalcon() {
  11. if [ -e "${php_install_dir}/bin/phpize" ]; then
  12. pushd ${oneinstack_dir}/src > /dev/null
  13. PHP_detail_ver=$(${php_install_dir}/bin/php-config --version)
  14. PHP_main_ver=${PHP_detail_ver%.*}
  15. phpExtensionDir=$(${php_install_dir}/bin/php-config --extension-dir)
  16. if [[ "${PHP_main_ver}" =~ ^7.[2-4]$|^8.3$ ]]; then
  17. src_url=https://pecl.php.net/get/phalcon-${phalcon_ver}.tgz && Download_src
  18. tar xzf phalcon-${phalcon_ver}.tgz
  19. pushd phalcon-${phalcon_ver} > /dev/null
  20. ${php_install_dir}/bin/phpize
  21. echo "${CMSG}It may take a few minutes... ${CEND}"
  22. ./configure --with-php-config=${php_install_dir}/bin/php-config
  23. make -j ${THREAD} && make install
  24. popd > /dev/null
  25. elif [[ "${PHP_main_ver}" =~ ^5.[5-6]$|^7.[0-1]$ ]]; then
  26. src_url=${mirror_link}/oneinstack/src/cphalcon-${phalcon_oldver}.tar.gz && Download_src
  27. tar xzf cphalcon-${phalcon_oldver}.tar.gz
  28. pushd cphalcon-${phalcon_oldver}/build > /dev/null
  29. echo "${CMSG}It may take a few minutes... ${CEND}"
  30. ./install --phpize ${php_install_dir}/bin/phpize --php-config ${php_install_dir}/bin/php-config --arch 64bits
  31. popd > /dev/null
  32. else
  33. echo "${CWARNING}Your php ${PHP_detail_ver} does not support phalcon! ${CEND}"
  34. fi
  35. if [ -f "${phpExtensionDir}/phalcon.so" ]; then
  36. echo 'extension=phalcon.so' > ${php_install_dir}/etc/php.d/04-phalcon.ini
  37. echo "${CSUCCESS}PHP phalcon module installed successfully! ${CEND}"
  38. rm -rf cphalcon-${phalcon_oldver} phalcon-${phalcon_ver}
  39. else
  40. echo "${CFAILURE}PHP phalcon module install failed, Please contact the author! ${CEND}" && grep -Ew 'NAME|ID|ID_LIKE|VERSION_ID|PRETTY_NAME' /etc/os-release
  41. fi
  42. popd > /dev/null
  43. fi
  44. }
  45. Uninstall_pecl_phalcon() {
  46. if [ -e "${php_install_dir}/etc/php.d/04-phalcon.ini" ]; then
  47. rm -f ${php_install_dir}/etc/php.d/04-phalcon.ini
  48. echo; echo "${CMSG}PHP phalcon module uninstall completed${CEND}"
  49. else
  50. echo; echo "${CWARNING}PHP phalcon module does not exist! ${CEND}"
  51. fi
  52. }