1
0

pecl_pgsql.sh 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. #!/bin/bash
  2. # Author: yeho <lj2007331 AT gmail.com>
  3. # BLOG: https://blog.linuxeye.cn
  4. #
  5. # Notes: OneinStack for CentOS/RedHat 6+ Debian 7+ and Ubuntu 12+
  6. #
  7. # Project home page:
  8. # https://oneinstack.com
  9. # https://github.com/oneinstack/oneinstack
  10. Install_pecl-pgsql() {
  11. pushd ${oneinstack_dir}/src > /dev/null
  12. if [ -e "${php_install_dir}/bin/phpize" ]; then
  13. phpExtensionDir=`${php_install_dir}/bin/php-config --extension-dir`
  14. PHP_detail_ver=$(${php_install_dir}/bin/php -r 'echo PHP_VERSION;')
  15. tar xzf php-${PHP_detail_ver}.tar.gz
  16. pushd php-${PHP_detail_ver}/ext/pgsql > /dev/null
  17. ${php_install_dir}/bin/phpize
  18. ./configure --with-pgsql=${pgsql_install_dir} --with-php-config=${php_install_dir}/bin/php-config
  19. make -j ${THREAD} && make install
  20. popd > /dev/null
  21. pushd php-${PHP_detail_ver}/ext/pdo_pgsql > /dev/null
  22. ${php_install_dir}/bin/phpize
  23. ./configure --with-pdo-pgsql=${pgsql_install_dir} --with-php-config=${php_install_dir}/bin/php-config
  24. make -j ${THREAD} && make install
  25. popd > /dev/null
  26. if [ -f "${phpExtensionDir}/pgsql.so" -a -f "${phpExtensionDir}/pdo_pgsql.so" ]; then
  27. echo 'extension=pgsql.so' > ${php_install_dir}/etc/php.d/07-pgsql.ini
  28. echo 'extension=pdo_pgsql.so' >> ${php_install_dir}/etc/php.d/07-pgsql.ini
  29. echo "${CSUCCESS}PHP pgsql module installed successfully! ${CEND}"
  30. rm -rf php-${PHP_detail_ver}
  31. else
  32. echo "${CFAILURE}PHP pgsql module install failed, Please contact the author! ${CEND}"
  33. fi
  34. fi
  35. popd > /dev/null
  36. }