Sfoglia il codice sorgente

Add pecl_mongodb and change args

lj2007331@gmail.com 6 anni fa
parent
commit
7059225f7b
13 ha cambiato i file con 232 aggiunte e 195 eliminazioni
  1. 2 2
      README.md
  2. 41 22
      addons.sh
  3. 1 5
      backup_setup.sh
  4. 1 1
      include/GraphicsMagick.sh
  5. 1 1
      include/ImageMagick.sh
  6. 46 36
      include/check_download.sh
  7. 17 17
      include/memcached.sh
  8. 9 9
      include/pecl_mongodb.sh
  9. 23 22
      include/pecl_pgsql.sh
  10. 6 6
      include/redis.sh
  11. 77 66
      install.sh
  12. 2 2
      uninstall.sh
  13. 6 6
      versions.txt

+ 2 - 2
README.md

@@ -12,12 +12,12 @@ Script properties:
 - Providing a plurality of Tomcat version (Tomcat-9, Tomcat-8, Tomcat-7, Tomcat-6)
 - Providing a plurality of JDK version (JDK-11.0, JDK-1.8, JDK-1.7, JDK-1.6)
 - Providing a plurality of Apache version (Apache-2.4, Apache-2.2)
-- According to their needs to install PHP Cache Accelerator provides ZendOPcache, xcache, apcu, eAccelerator. And php encryption and decryption tool ionCube, ZendGuardLoader, swoole, xdebug, Composer
+- According to their needs to install PHP Cache Accelerator provides ZendOPcache, xcache, apcu, eAccelerator. And php encryption and decryption tool ionCube, ZendGuardLoader, SourceGuardian, swoole, xdebug, Composer
 - Installation Pureftpd, phpMyAdmin according to their needs
 - Install memcached, redis according to their needs
 - Jemalloc optimize MySQL, Nginx
 - Providing add a virtual host script, include Let's Encrypt SSL certificate
-- Provide Nginx/Tengine/OpenResty/Apache, MySQL/MariaDB/Percona, PHP, Redis, Memcached, phpMyAdmin upgrade script
+- Provide Nginx/Tengine/OpenResty/Apache/Tomcat, MySQL/MariaDB/Percona, PHP, Redis, Memcached, phpMyAdmin upgrade script
 - Provide local backup,remote backup (rsync between servers),Aliyun OSS,Qcloud COS,UPYUN and QINIU script
 - Provided under HHVM install CentOS 6,7
 

+ 41 - 22
addons.sh

@@ -48,6 +48,8 @@ IPADDR_COUNTRY=$(./include/get_ipaddr_state.py $PUBLIC_IPADDR)
 . ./include/ImageMagick.sh
 . ./include/GraphicsMagick.sh
 
+. ./include/pecl_mongodb.sh
+
 . ./include/memcached.sh
 
 . ./include/redis.sh
@@ -134,13 +136,13 @@ EOF
   sed -i 's@^iptables = iptables.*@iptables = iptables@' /etc/fail2ban/action.d/iptables-common.conf
   kill -9 `ps -ef | grep fail2ban | grep -v grep | awk '{print $2}'` > /dev/null 2>&1
   /etc/init.d/fail2ban start
-  popd
+  popd > /dev/null
   if [ -e "${python_install_dir}/bin/fail2ban-python" ]; then
     echo; echo "${CSUCCESS}fail2ban installed successfully! ${CEND}"
   else
     echo; echo "${CFAILURE}fail2ban install failed, Please try again! ${CEND}"
   fi
-  popd
+  popd > /dev/null
 }
 
 Uninstall_fail2ban() {
@@ -172,7 +174,7 @@ What Are You Doing?
 \t${CMSG} 1${CEND}. Install/Uninstall PHP opcode cache
 \t${CMSG} 2${CEND}. Install/Uninstall ZendGuardLoader/ionCube/SourceGuardian PHP Extension
 \t${CMSG} 3${CEND}. Install/Uninstall ImageMagick/GraphicsMagick PHP Extension
-\t${CMSG} 4${CEND}. Install/Uninstall fileinfo/imap/phalcon PHP Extension
+\t${CMSG} 4${CEND}. Install/Uninstall fileinfo/imap/phalcon/mongodb PHP Extension
 \t${CMSG} 5${CEND}. Install/Uninstall memcached/memcache
 \t${CMSG} 6${CEND}. Install/Uninstall Redis
 \t${CMSG} 7${CEND}. Install/Uninstall swoole PHP Extension
@@ -229,7 +231,7 @@ What Are You Doing?
                 src_url=http://www.php.net/distributions/php-${PHP_detail_ver}.tar.gz && Download_src
                 Install_ZendOPcache
               fi
-              popd
+              popd > /dev/null
               Check_succ
               ;;
             2)
@@ -338,11 +340,11 @@ What Are You Doing?
           magick_yn=y && checkDownload
           if [ "${magick_option}" = '1' ]; then
             [ ! -d "${imagick_install_dir}" ] && Install_ImageMagick
-            Install_php-imagick
+            Install_pecl-imagick
             Check_succ
           elif [ "${magick_option}" = '2' ]; then
             [ ! -d "${gmagick_install_dir}" ] && Install_GraphicsMagick
-            Install_php-gmagick
+            Install_pecl-gmagick
             Check_succ
           fi
         else
@@ -354,14 +356,15 @@ What Are You Doing?
       4)
         ACTION_FUN
         while :; do echo
-          echo "Please select fileinfo/imap/phalcon:"
+          echo "Please select fileinfo/imap/phalcon/mongodb:"
           echo -e "\t${CMSG}1${CEND}. fileinfo"
           echo -e "\t${CMSG}2${CEND}. imap"
           echo -e "\t${CMSG}3${CEND}. phalcon"
+          echo -e "\t${CMSG}4${CEND}. mongodb"
           read -e -p "Please input a number:(Default 1 press Enter) " phpext_option
           [ -z "${phpext_option}" ] && phpext_option=1
-          if [[ ! "${phpext_option}" =~ ^[1-3]$ ]]; then
-            echo "${CWARNING}input error! Please only input number 1~3${CEND}"
+          if [[ ! "${phpext_option}" =~ ^[1-4]$ ]]; then
+            echo "${CWARNING}input error! Please only input number 1~4${CEND}"
           else
             if [ "${phpext_option}" = '1' ]; then
               PHP_extension=fileinfo
@@ -376,6 +379,12 @@ What Are You Doing?
               fi
             elif [ "${phpext_option}" = '3' ]; then
               PHP_extension=phalcon
+            elif [ "${phpext_option}" = '4' ]; then
+              if [[ "${PHP_main_ver}" =~ ^5.[3-4]$ ]]; then
+                PHP_extension=mongo
+              else
+                PHP_extension=mongodb
+              fi
             fi
             break
           fi
@@ -391,7 +400,8 @@ What Are You Doing?
             ${php_install_dir}/bin/phpize
             ./configure --with-php-config=${php_install_dir}/bin/php-config ${IMAP_ARGS}
             make -j ${THREAD} && make install
-            popd
+            [ -f "${phpExtensionDir}/${PHP_extension}.so" ] && echo "extension=${PHP_extension}.so" > ${php_install_dir}/etc/php.d/04-${PHP_extension}.ini
+            popd > /dev/null
             rm -rf php-${PHP_detail_ver}
           elif [ "${phpext_option}" = '3' ]; then
             if [[ "${PHP_main_ver}" =~ ^5.[5-6]$|^7.[0-2]$ ]]; then
@@ -399,14 +409,23 @@ What Are You Doing?
               tar xzf cphalcon-${phalcon_ver}.tar.gz
               pushd cphalcon-${phalcon_ver}/build
               ./install --phpize ${php_install_dir}/bin/phpize --php-config ${php_install_dir}/bin/php-config --arch ${OS_BIT}bits
-              popd
+              [ -f "${phpExtensionDir}/${PHP_extension}.so" ] && echo "extension=${PHP_extension}.so" > ${php_install_dir}/etc/php.d/04-${PHP_extension}.ini
+              popd > /dev/null
               rm -rf cphalcon-${phalcon_ver}
             else
               echo; echo "${CWARNING}Your php ${PHP_detail_ver} does not support ${PHP_extension}! ${CEND}";
             fi
+          elif [ "${phpext_option}" = '4' ]; then
+            if [ "${PHP_extension}" == 'mongo' ]; then
+              echo "Download pecl mongo for php..."
+              src_url=https://pecl.php.net/get/mongo-${pecl_mongo_ver}.tgz && Download_src
+            elif [ "${PHP_extension}" == 'mongo' ]; then
+              echo "Download pecl mongodb for php..."
+              src_url=https://pecl.php.net/get/mongodb-${pecl_mongodb_ver}.tgz && Download_src
+            fi
+            Install_pecl-mongodb
           fi
-          popd
-          [ -f "${phpExtensionDir}/${PHP_extension}.so" ] && echo "extension=${PHP_extension}.so" > ${php_install_dir}/etc/php.d/04-${PHP_extension}.ini
+          popd > /dev/null
           Check_succ
         else
           Uninstall_succ
@@ -435,21 +454,21 @@ What Are You Doing?
             1)
               [ ! -d "${memcached_install_dir}/include/memcached" ] && Install_memcached
               Check_PHP_Extension
-              Install_php-memcache
+              Install_pecl-memcache
               Check_succ
               ;;
             2)
               [ ! -d "${memcached_install_dir}/include/memcached" ] && Install_memcached
               Check_PHP_Extension
-              Install_php-memcached
+              Install_pecl-memcached
               Check_succ
               ;;
             3)
               [ ! -d "${memcached_install_dir}/include/memcached" ] && Install_memcached
               PHP_extension=memcache && Check_PHP_Extension
-              Install_php-memcache
+              Install_pecl-memcache
               PHP_extension=memcached && Check_PHP_Extension
-              Install_php-memcached
+              Install_pecl-memcached
               [ -f "${phpExtensionDir}/memcache.so" -a "${phpExtensionDir}/memcached.so" ] && { Restart_PHP; echo;echo "${CSUCCESS}PHP memcache/memcached module installed successfully! ${CEND}"; }
               ;;
           esac
@@ -466,7 +485,7 @@ What Are You Doing?
         if [ "${ACTION}" = '1' ]; then
           [ ! -d "${redis_install_dir}" ] && Install_redis-server
           Check_PHP_Extension
-          Install_php-redis
+          Install_pecl-redis
         else
           Uninstall_succ
           [ -e "${redis_install_dir}" ] && { service redis-server stop > /dev/null 2>&1; rm -rf ${redis_install_dir} /etc/init.d/redis-server /usr/local/bin/redis-*; }
@@ -490,9 +509,9 @@ What Are You Doing?
           ${php_install_dir}/bin/phpize
           ./configure --with-php-config=${php_install_dir}/bin/php-config --enable-openssl --with-openssl-dir=${openssl_install_dir}
           make -j ${THREAD} && make install
-          popd
+          popd > /dev/null
           rm -rf swoole-${swoole_ver}
-          popd
+          popd > /dev/null
           echo 'extension=swoole.so' > ${php_install_dir}/etc/php.d/06-swoole.ini
           Check_succ
         else
@@ -526,9 +545,9 @@ What Are You Doing?
           ${php_install_dir}/bin/phpize
           ./configure --with-php-config=${php_install_dir}/bin/php-config
           make -j ${THREAD} && make install
-          popd
+          popd > /dev/null
           rm -rf xdebug-${xdebug_ver}
-          popd
+          popd > /dev/null
           [ ! -e /tmp/xdebug ] && { mkdir /tmp/xdebug; chown ${run_user}.${run_user} /tmp/xdebug; }
           [ ! -e /tmp/webgrind ] && { mkdir /tmp/webgrind; chown ${run_user}.${run_user} /tmp/webgrind; }
           chown -R ${run_user}.${run_user} ${wwwroot_dir}/default/webgrind

+ 1 - 5
backup_setup.sh

@@ -171,11 +171,7 @@ fi
 
 if [ `echo ${desc_bk} | grep -e 3` ]; then
   if [ ! -e "/usr/local/bin/ossutil" ]; then
-    if [ "${OS_BIT}" == '64' ]; then
-      wget -qc http://docs-aliyun.cn-hangzhou.oss.aliyun-inc.com/assets/attach/50452/cn_zh/1524643963683/ossutil64 -O /usr/local/bin/ossutil
-    elif [ "${OS_BIT}" == '32' ]; then
-      wget -qc http://docs-aliyun.cn-hangzhou.oss.aliyun-inc.com/assets/attach/50452/cn_zh/1524643908776/ossutil32 -O /usr/local/bin/ossutil
-    fi
+    wget -qc http://gosspublic.alicdn.com/ossutil/1.4.1/ossutil${OS_BIT} -O /usr/local/bin/ossutil
     chmod +x /usr/local/bin/ossutil
   fi
   while :; do echo

+ 1 - 1
include/GraphicsMagick.sh

@@ -19,7 +19,7 @@ Install_GraphicsMagick() {
   popd
 }
 
-Install_php-gmagick() {
+Install_pecl-gmagick() {
   pushd ${oneinstack_dir}/src > /dev/null
   if [ -e "${php_install_dir}/bin/phpize" ]; then
     phpExtensionDir=`${php_install_dir}/bin/php-config --extension-dir`

+ 1 - 1
include/ImageMagick.sh

@@ -19,7 +19,7 @@ Install_ImageMagick() {
   popd
 }
 
-Install_php-imagick() {
+Install_pecl-imagick() {
   pushd ${oneinstack_dir}/src > /dev/null
   if [ -e "${php_install_dir}/bin/phpize" ]; then
     phpExtensionDir=`${php_install_dir}/bin/php-config --extension-dir`

+ 46 - 36
include/check_download.sh

@@ -16,6 +16,12 @@ checkDownload() {
   echo "Download cacert.pem..."
   src_url=https://curl.haxx.se/ca/cacert.pem && Download_src
 
+  # jemalloc
+  if [[ ${nginx_option} =~ ^[1-3]$ ]] || [ "${db_yn}" == 'y' ]; then
+    echo "Download jemalloc..."
+    src_url=${mirrorLink}/jemalloc-${jemalloc_ver}.tar.bz2 && Download_src
+  fi
+
   # Web
   if [ "${web_yn}" == 'y' ]; then
     case "${nginx_option}" in
@@ -609,6 +615,7 @@ checkDownload() {
         ;;
     esac
   fi
+
   # PHP
   if [ "${php_yn}" == 'y' ]; then
     # php 5.3 5.4 5.5 5.6 5.7
@@ -712,13 +719,7 @@ checkDownload() {
     esac
   fi
 
-  if [ -e "${mongo_install_dir}/bin/mongo" -o "${db_option}" == '14' ]; then
-    echo "Download pecl mongo for php..."
-    src_url=https://pecl.php.net/get/mongo-${mongo_pecl_ver}.tgz && Download_src
-    echo "Download pecl mongodb for php..."
-    src_url=https://pecl.php.net/get/mongodb-${mongodb_pecl_ver}.tgz && Download_src
-  fi
-
+  # ioncube
   if [ "${ioncube_yn}" == 'y' ]; then
     echo "Download ioncube..."
     if [ "${TARGET_ARCH}" == "armv7" ]; then
@@ -728,6 +729,7 @@ checkDownload() {
     fi
   fi
 
+  # SourceGuardian
   if [ "${sourceguardian_yn}" == 'y' ]; then
     echo "Download SourceGuardian..."
     if [ "${TARGET_ARCH}" == "armv8" ]; then
@@ -737,6 +739,7 @@ checkDownload() {
     fi
   fi
 
+  # ImageMagick graphicsmagick
   if [ "${magick_yn}" == 'y' ]; then
     if [ "${magick_option}" == '1' ]; then
       echo "Download ImageMagick..."
@@ -756,55 +759,62 @@ checkDownload() {
     fi
   fi
 
-  if [ "${ftp_yn}" == 'y' ]; then
-    echo "Download pureftpd..."
-    src_url=https://download.pureftpd.org/pub/pure-ftpd/releases/pure-ftpd-${pureftpd_ver}.tar.gz && Download_src
-  fi
-
-  if [ "${phpmyadmin_yn}" == 'y' ]; then
-    echo "Download phpMyAdmin..."
-    if [[ "${php_option}" =~ ^[1-2]$ ]]; then
-      src_url=https://files.phpmyadmin.net/phpMyAdmin/${phpmyadmin_oldver}/phpMyAdmin-${phpmyadmin_oldver}-all-languages.tar.gz && Download_src
-    else
-      src_url=https://files.phpmyadmin.net/phpMyAdmin/${phpmyadmin_ver}/phpMyAdmin-${phpmyadmin_ver}-all-languages.tar.gz && Download_src
-    fi
-  fi
-
-  if [ "${redis_yn}" == 'y' ]; then
+  # redis-server pecl_redis
+  if [ "${redis_yn}" == 'y' -o "${pecl_redis}" == '1' ]; then
     echo "Download redis..."
     src_url=http://download.redis.io/releases/redis-${redis_ver}.tar.gz && Download_src
-    echo "Download redis pecl..."
-    src_url=https://pecl.php.net/get/redis-${redis_pecl_ver}.tgz && Download_src
+    echo "Download pecl_redis..."
+    src_url=https://pecl.php.net/get/redis-${pecl_redis_ver}.tgz && Download_src
     if [ "${PM}" == 'yum' ]; then
       echo "Download start-stop-daemon.c for CentOS..."
       src_url=${mirrorLink}/start-stop-daemon.c && Download_src
     fi
   fi
 
-  if [ "${memcached_yn}" == 'y' ]; then
+  # memcached-server pecl_memcached pecl_memcache
+  if [ "${memcached_yn}" == 'y' -o "${pecl_memcached}" == '1' -o "${pecl_memcache}" == '1' ]; then
     echo "Download memcached..."
     [ "$IPADDR_COUNTRY"x == "CN"x ] && DOWN_ADDR=${mirrorLink} || DOWN_ADDR=http://www.memcached.org/files
     src_url=${DOWN_ADDR}/memcached-${memcached_ver}.tar.gz && Download_src
     if [[ "${php_option}" =~ ^[5-7]$ ]]; then
-      echo "Download pecl memcache for php 7.x..."
+      echo "Download pecl_memcache for php 7.x..."
       # src_url=https://codeload.github.com/websupport-sk/pecl-memcache/zip/php7 && Download_src
       src_url=${mirrorLink}/pecl-memcache-php7.tgz && Download_src
-      echo "Download pecl memcached for php 7.x..."
-      src_url=https://pecl.php.net/get/memcached-${memcached_pecl_php7_ver}.tgz && Download_src
+      echo "Download pecl_memcached for php 7.x..."
+      src_url=https://pecl.php.net/get/memcached-${pecl_memcached_php7_ver}.tgz && Download_src
     else
-      echo "Download pecl memcache for php..."
-      src_url=https://pecl.php.net/get/memcache-${memcache_pecl_ver}.tgz && Download_src
-      echo "Download pecl memcached for php..."
-      src_url=https://pecl.php.net/get/memcached-${memcached_pecl_ver}.tgz && Download_src
+      echo "Download pecl_memcache for php..."
+      src_url=https://pecl.php.net/get/memcache-${pecl_memcache_ver}.tgz && Download_src
+      echo "Download pecl_memcached for php..."
+      src_url=https://pecl.php.net/get/memcached-${pecl_memcached_ver}.tgz && Download_src
     fi
 
     echo "Download libmemcached..."
     src_url=https://launchpad.net/libmemcached/1.0/${libmemcached_ver}/+download/libmemcached-${libmemcached_ver}.tar.gz && Download_src
   fi
 
-  if [[ ${nginx_option} =~ ^[1-3]$ ]] || [ "${db_yn}" == 'y' ]; then
-    echo "Download jemalloc..."
-    src_url=${mirrorLink}/jemalloc-${jemalloc_ver}.tar.bz2 && Download_src
+  # pecl_mongodb
+  if [ -e "${mongo_install_dir}/bin/mongo" -o "${db_option}" == '14' -o "${pecl_mongodb}" == '1' ]; then
+    echo "Download pecl mongo for php..."
+    src_url=https://pecl.php.net/get/mongo-${pecl_mongo_ver}.tgz && Download_src
+    echo "Download pecl mongodb for php..."
+    src_url=https://pecl.php.net/get/mongodb-${pecl_mongodb_ver}.tgz && Download_src
+  fi
+
+  # pureftpd
+  if [ "${ftp_yn}" == 'y' ]; then
+    echo "Download pureftpd..."
+    src_url=https://download.pureftpd.org/pub/pure-ftpd/releases/pure-ftpd-${pureftpd_ver}.tar.gz && Download_src
+  fi
+
+  # phpMyAdmin
+  if [ "${phpmyadmin_yn}" == 'y' ]; then
+    echo "Download phpMyAdmin..."
+    if [[ "${php_option}" =~ ^[1-2]$ ]]; then
+      src_url=https://files.phpmyadmin.net/phpMyAdmin/${phpmyadmin_oldver}/phpMyAdmin-${phpmyadmin_oldver}-all-languages.tar.gz && Download_src
+    else
+      src_url=https://files.phpmyadmin.net/phpMyAdmin/${phpmyadmin_ver}/phpMyAdmin-${phpmyadmin_ver}-all-languages.tar.gz && Download_src
+    fi
   fi
 
   # others
@@ -824,5 +834,5 @@ checkDownload() {
     fi
   fi
 
-  popd
+  popd > /dev/null
 }

+ 17 - 17
include/memcached.sh

@@ -42,7 +42,7 @@ Install_memcached() {
   popd
 }
 
-Install_php-memcache() {
+Install_pecl-memcache() {
   pushd ${oneinstack_dir}/src > /dev/null
   if [ -e "${php_install_dir}/bin/phpize" ]; then
     phpExtensionDir=$(${php_install_dir}/bin/php-config --extension-dir)
@@ -51,62 +51,62 @@ Install_php-memcache() {
       #git clone https://github.com/websupport-sk/pecl-memcache.git
       #cd pecl-memcache
       tar xzf pecl-memcache-php7.tgz
-      pushd pecl-memcache-php7
+      pushd pecl-memcache-php7 > /dev/null
     else
-      tar xzf memcache-${memcache_pecl_ver}.tgz
-      pushd memcache-${memcache_pecl_ver}
+      tar xzf memcache-${pecl_memcache_ver}.tgz
+      pushd memcache-${pecl_memcache_ver} > /dev/null
     fi
     ${php_install_dir}/bin/phpize
     ./configure --with-php-config=${php_install_dir}/bin/php-config
     make -j ${THREAD} && make install
-    popd
+    popd > /dev/null
     if [ -f "${phpExtensionDir}/memcache.so" ]; then
       echo "extension=memcache.so" > ${php_install_dir}/etc/php.d/05-memcache.ini
       echo "${CSUCCESS}PHP memcache module installed successfully! ${CEND}"
-      rm -rf pecl-memcache-php7 memcache-${memcache_pecl_ver}
+      rm -rf pecl-memcache-php7 memcache-${pecl_memcache_ver}
     else
       echo "${CFAILURE}PHP memcache module install failed, Please contact the author! ${CEND}"
     fi
   fi
-  popd
+  popd > /dev/null
 }
 
-Install_php-memcached() {
+Install_pecl-memcached() {
   pushd ${oneinstack_dir}/src > /dev/null
   if [ -e "${php_install_dir}/bin/phpize" ]; then
     phpExtensionDir=$(${php_install_dir}/bin/php-config --extension-dir)
     # php memcached extension
     tar xzf libmemcached-${libmemcached_ver}.tar.gz
     patch -d libmemcached-${libmemcached_ver} -p0 < libmemcached-build.patch
-    pushd libmemcached-${libmemcached_ver}
+    pushd libmemcached-${libmemcached_ver} > /dev/null
     [ "${PM}" == 'yum' ] && yum -y install cyrus-sasl-devel
     [ "${PM}" == 'apt' ] && sed -i "s@lthread -pthread -pthreads@lthread -lpthread -pthreads@" ./configure
     ./configure --with-memcached=${memcached_install_dir}
     make -j ${THREAD} && make install
-    popd
+    popd > /dev/null
     rm -rf libmemcached-${libmemcached_ver}
 
     if [ "$(${php_install_dir}/bin/php -r 'echo PHP_VERSION;' | awk -F. '{print $1}')" == '7' ]; then
-      tar xzf memcached-${memcached_pecl_php7_ver}.tgz
-      pushd memcached-${memcached_pecl_php7_ver}
+      tar xzf memcached-${pecl_memcached_php7_ver}.tgz
+      pushd memcached-${pecl_memcached_php7_ver} > /dev/null
     else
-      tar xzf memcached-${memcached_pecl_ver}.tgz
-      pushd memcached-${memcached_pecl_ver}
+      tar xzf memcached-${pecl_memcached_ver}.tgz
+      pushd memcached-${pecl_memcached_ver} > /dev/null
     fi
     ${php_install_dir}/bin/phpize
     ./configure --with-php-config=${php_install_dir}/bin/php-config
     make -j ${THREAD} && make install
-    popd
+    popd > /dev/null
     if [ -f "${phpExtensionDir}/memcached.so" ]; then
       cat > ${php_install_dir}/etc/php.d/05-memcached.ini << EOF
 extension=memcached.so
 memcached.use_sasl=1
 EOF
       echo "${CSUCCESS}PHP memcached module installed successfully! ${CEND}"
-      rm -rf memcached-${memcached_pecl_ver} memcached-${memcached_pecl_php7_ver}
+      rm -rf memcached-${pecl_memcached_ver} memcached-${pecl_memcached_php7_ver}
     else
       echo "${CFAILURE}PHP memcached module install failed, Please contact the author! ${CEND}"
     fi
   fi
-  popd
+  popd > /dev/null
 }

+ 9 - 9
include/pecl_mongodb.sh

@@ -13,34 +13,34 @@ Install_pecl-mongodb() {
   if [ -e "${php_install_dir}/bin/phpize" ]; then
     phpExtensionDir=$(${php_install_dir}/bin/php-config --extension-dir)
     if [[ "$(${php_install_dir}/bin/php -r 'echo PHP_VERSION;' | awk -F. '{print $1$2}')" =~ ^5[3-4]$ ]]; then
-      tar xzf mongo-${mongo_pecl_ver}.tgz
-      pushd mongo-${mongo_pecl_ver}
+      tar xzf mongo-${pecl_mongo_ver}.tgz
+      pushd mongo-${pecl_mongo_ver} > /dev/null
       ${php_install_dir}/bin/phpize
       ./configure --with-php-config=${php_install_dir}/bin/php-config
       make -j ${THREAD} && make install
-      popd
+      popd > /dev/null
       if [ -f "${phpExtensionDir}/mongo.so" ]; then
         echo 'extension=mongo.so' > ${php_install_dir}/etc/php.d/07-mongo.ini
-        rm -rf mongo-${mongo_pecl_ver}
+        rm -rf mongo-${pecl_mongo_ver}
         echo "${CSUCCESS}PHP mongo module installed successfully! ${CEND}"
       else
         echo "${CFAILURE}PHP mongo module install failed, Please contact the author! ${CEND}"
       fi
     else
-      tar xzf mongodb-${mongodb_pecl_ver}.tgz
-      pushd mongodb-${mongodb_pecl_ver}
+      tar xzf mongodb-${pecl_mongodb_ver}.tgz
+      pushd mongodb-${pecl_mongodb_ver} > /dev/null
       ${php_install_dir}/bin/phpize
       ./configure --with-php-config=${php_install_dir}/bin/php-config
       make -j ${THREAD} && make install
-      popd
+      popd > /dev/null
       if [ -f "${phpExtensionDir}/mongodb.so" ]; then
         echo 'extension=mongodb.so' > ${php_install_dir}/etc/php.d/07-mongodb.ini
-        rm -rf mongodb-${mongodb_pecl_ver}
+        rm -rf mongodb-${pecl_mongodb_ver}
         echo "${CSUCCESS}PHP mongodb module installed successfully! ${CEND}"
       else
         echo "${CFAILURE}PHP mongodb module install failed, Please contact the author! ${CEND}"
       fi
     fi
   fi
-  popd
+  popd > /dev/null
 }

+ 23 - 22
include/pecl_pgsql.sh

@@ -10,27 +10,28 @@
 
 Install_pecl-pgsql() {
   pushd ${oneinstack_dir}/src > /dev/null
-  phpExtensionDir=`${php_install_dir}/bin/php-config --extension-dir`
-  PHP_detail_ver=$(${php_install_dir}/bin/php -r 'echo PHP_VERSION;')
-  tar xzf php-${PHP_detail_ver}.tar.gz
-  pushd php-${PHP_detail_ver}/ext/pgsql
-  ${php_install_dir}/bin/phpize
-  ./configure --with-pgsql=${pgsql_install_dir} --with-php-config=${php_install_dir}/bin/php-config
-  make -j ${THREAD} && make install
-  popd
-  pushd php-${PHP_detail_ver}/ext/pdo_pgsql
-  ${php_install_dir}/bin/phpize
-  ./configure --with-pdo-pgsql=${pgsql_install_dir} --with-php-config=${php_install_dir}/bin/php-config
-  make -j ${THREAD} && make install
-  popd
-  if [ -f "${phpExtensionDir}/pgsql.so" -a -f "${phpExtensionDir}/pdo_pgsql.so" ]; then
-    echo 'extension=pgsql.so' > ${php_install_dir}/etc/php.d/07-pgsql.ini
-    echo 'extension=pdo_pgsql.so' >> ${php_install_dir}/etc/php.d/07-pgsql.ini
-    echo "${CSUCCESS}PHP pgsql module installed successfully! ${CEND}"
-    popd
-    rm -rf php-${PHP_detail_ver}
-  else
-    echo "${CFAILURE}PHP pgsql module install failed, Please contact the author! ${CEND}"
+  if [ -e "${php_install_dir}/bin/phpize" ]; then
+    phpExtensionDir=`${php_install_dir}/bin/php-config --extension-dir`
+    PHP_detail_ver=$(${php_install_dir}/bin/php -r 'echo PHP_VERSION;')
+    tar xzf php-${PHP_detail_ver}.tar.gz
+    pushd php-${PHP_detail_ver}/ext/pgsql > /dev/null
+    ${php_install_dir}/bin/phpize
+    ./configure --with-pgsql=${pgsql_install_dir} --with-php-config=${php_install_dir}/bin/php-config
+    make -j ${THREAD} && make install
+    popd > /dev/null
+    pushd php-${PHP_detail_ver}/ext/pdo_pgsql > /dev/null
+    ${php_install_dir}/bin/phpize
+    ./configure --with-pdo-pgsql=${pgsql_install_dir} --with-php-config=${php_install_dir}/bin/php-config
+    make -j ${THREAD} && make install
+    popd > /dev/null
+    if [ -f "${phpExtensionDir}/pgsql.so" -a -f "${phpExtensionDir}/pdo_pgsql.so" ]; then
+      echo 'extension=pgsql.so' > ${php_install_dir}/etc/php.d/07-pgsql.ini
+      echo 'extension=pdo_pgsql.so' >> ${php_install_dir}/etc/php.d/07-pgsql.ini
+      echo "${CSUCCESS}PHP pgsql module installed successfully! ${CEND}"
+      rm -rf php-${PHP_detail_ver}
+    else
+      echo "${CFAILURE}PHP pgsql module install failed, Please contact the author! ${CEND}"
+    fi
   fi
-  popd
+  popd > /dev/null
 }

+ 6 - 6
include/redis.sh

@@ -57,23 +57,23 @@ Install_redis-server() {
   popd
 }
 
-Install_php-redis() {
+Install_pecl-redis() {
   pushd ${oneinstack_dir}/src > /dev/null
   if [ -e "${php_install_dir}/bin/phpize" ]; then
     phpExtensionDir=`${php_install_dir}/bin/php-config --extension-dir`
-    tar xzf redis-${redis_pecl_ver}.tgz
-    pushd redis-${redis_pecl_ver}
+    tar xzf redis-${pecl_redis_ver}.tgz
+    pushd redis-${pecl_redis_ver} > /dev/null
     ${php_install_dir}/bin/phpize
     ./configure --with-php-config=${php_install_dir}/bin/php-config
     make -j ${THREAD} && make install
+    popd > /dev/null
     if [ -f "${phpExtensionDir}/redis.so" ]; then
       echo 'extension=redis.so' > ${php_install_dir}/etc/php.d/05-redis.ini
       echo "${CSUCCESS}PHP Redis module installed successfully! ${CEND}"
-      popd
-      rm -rf redis-${redis_pecl_ver}
+      rm -rf redis-${pecl_redis_ver}
     else
       echo "${CFAILURE}PHP Redis module install failed, Please contact the author! ${CEND}"
     fi
   fi
-  popd
+  popd > /dev/null
 }

+ 77 - 66
install.sh

@@ -50,7 +50,7 @@ showhelp() {
   --apache_option [1-2]       Install Apache server version
   --php_option [1-7]          Install PHP version
   --phpcache_option [1-4]     Install PHP opcode cache, default: 1 opcache
-  --php_extensions [ext name] Install PHP extension, include zendguardloader,ioncube,imagick,gmagick,redis,memcached,memcache
+  --php_extensions [ext name] Install PHP extension, include zendguardloader,ioncube,sourceguardian,imagick,gmagick,redis,memcached,memcache,mongodb
   --tomcat_option [1-4]       Install Tomcat version
   --jdk_option [1-4]          Install JDK version
   --db_option [1-15]          Install DB version
@@ -106,11 +106,13 @@ while :; do
       php_extensions=$2; shift 2
       [ -n "`echo ${php_extensions} | grep -w zendguardloader`" ] && zendguardloader_yn=y
       [ -n "`echo ${php_extensions} | grep -w ioncube`" ] && ioncube_yn=y
+      [ -n "`echo ${php_extensions} | grep -w sourceguardian`" ] && sourceguardian_yn=y
       [ -n "`echo ${php_extensions} | grep -w imagick`" ] && magick_option=1
       [ -n "`echo ${php_extensions} | grep -w gmagick`" ] && magick_option=2
-      [ -n "`echo ${php_extensions} | grep -w redis`" ] && redis_pecl=1
-      [ -n "`echo ${php_extensions} | grep -w memcached`" ] && memcached_pecl=1
-      [ -n "`echo ${php_extensions} | grep -w memcache`" ] && memcache_pecl=1
+      [ -n "`echo ${php_extensions} | grep -w redis`" ] && pecl_redis=1
+      [ -n "`echo ${php_extensions} | grep -w memcached`" ] && pecl_memcached=1
+      [ -n "`echo ${php_extensions} | grep -w memcache`" ] && pecl_memcache=1
+      [ -n "`echo ${php_extensions} | grep -w mongodb`" ] && pecl_mongodb=1
       ;;
     --tomcat_option)
       tomcat_option=$2; shift 2
@@ -777,6 +779,22 @@ case "${db_option}" in
     ;;
 esac
 
+# Nginx server
+case "${nginx_option}" in
+  1)
+    . include/nginx.sh
+    Install_Nginx 2>&1 | tee -a ${oneinstack_dir}/install.log
+    ;;
+  2)
+    . include/tengine.sh
+    Install_Tengine 2>&1 | tee -a ${oneinstack_dir}/install.log
+    ;;
+  3)
+    . include/openresty.sh
+    Install_OpenResty 2>&1 | tee -a ${oneinstack_dir}/install.log
+    ;;
+esac
+
 # Apache
 if [ "${apache_option}" == '1' ]; then
   . include/apache-2.4.sh
@@ -818,35 +836,6 @@ case "${php_option}" in
     ;;
 esac
 
-# pecl_pgsql
-if [ -e "${pgsql_install_dir}/bin/psql" -a -e "${php_install_dir}/bin/phpize" ]; then
-  . include/pecl_pgsql.sh
-  Install_pecl-pgsql 2>&1 | tee -a ${oneinstack_dir}/install.log
-fi
-
-# pecl_mongodb
-if [ -e "${mongo_install_dir}/bin/mongo" -a -e "${php_install_dir}/bin/phpize" ]; then
-  . include/pecl_mongodb.sh
-  Install_pecl-mongodb 2>&1 | tee -a ${oneinstack_dir}/install.log
-fi
-
-# ImageMagick or GraphicsMagick
-if [ "${magick_option}" == '1' ]; then
-  . include/ImageMagick.sh
-  [ ! -d "${imagick_install_dir}" ] && Install_ImageMagick 2>&1 | tee -a ${oneinstack_dir}/install.log
-  [ ! -e "`${php_install_dir}/bin/php-config --extension-dir`/imagick.so" ] && Install_php-imagick 2>&1 | tee -a ${oneinstack_dir}/install.log
-elif [ "${magick_option}" == '2' ]; then
-  . include/GraphicsMagick.sh
-  [ ! -d "${gmagick_install_dir}" ] && Install_GraphicsMagick 2>&1 | tee -a ${oneinstack_dir}/install.log
-  [ ! -e "`${php_install_dir}/bin/php-config --extension-dir`/gmagick.so" ] && Install_php-gmagick 2>&1 | tee -a ${oneinstack_dir}/install.log
-fi
-
-# ionCube
-if [ "${ioncube_yn}" == 'y' ]; then
-  . include/ioncube.sh
-  Install_ionCube 2>&1 | tee -a ${oneinstack_dir}/install.log
-fi
-
 # PHP opcode cache
 case "${phpcache_option}" in
   1)
@@ -877,21 +866,58 @@ if [ "${zendguardloader_yn}" == 'y' ]; then
   Install_ZendGuardLoader 2>&1 | tee -a ${oneinstack_dir}/install.log
 fi
 
-# Web server
-case "${nginx_option}" in
-  1)
-    . include/nginx.sh
-    Install_Nginx 2>&1 | tee -a ${oneinstack_dir}/install.log
-    ;;
-  2)
-    . include/tengine.sh
-    Install_Tengine 2>&1 | tee -a ${oneinstack_dir}/install.log
-    ;;
-  3)
-    . include/openresty.sh
-    Install_OpenResty 2>&1 | tee -a ${oneinstack_dir}/install.log
-    ;;
-esac
+# ionCube
+if [ "${ioncube_yn}" == 'y' ]; then
+  . include/ioncube.sh
+  Install_ionCube 2>&1 | tee -a ${oneinstack_dir}/install.log
+fi
+
+# SourceGuardian
+if [ "${sourceguardian_yn}" == 'y' ]; then
+  . include/sourceguardian.sh
+  Install_SourceGuardian 2>&1 | tee -a ${oneinstack_dir}/install.log
+fi
+
+# ImageMagick or GraphicsMagick
+if [ "${magick_option}" == '1' ]; then
+  . include/ImageMagick.sh
+  [ ! -d "${imagick_install_dir}" ] && Install_ImageMagick 2>&1 | tee -a ${oneinstack_dir}/install.log
+  Install_pecl-imagick 2>&1 | tee -a ${oneinstack_dir}/install.log
+elif [ "${magick_option}" == '2' ]; then
+  . include/GraphicsMagick.sh
+  [ ! -d "${gmagick_install_dir}" ] && Install_GraphicsMagick 2>&1 | tee -a ${oneinstack_dir}/install.log
+  Install_pecl-gmagick 2>&1 | tee -a ${oneinstack_dir}/install.log
+fi
+
+# pecl_memcached
+if [ "${pecl_memcached}" == '1' ]; then
+  . include/memcached.sh
+  Install_pecl-memcached 2>&1 | tee -a ${oneinstack_dir}/install.log
+fi
+
+# pecl_memcache
+if [ "${pecl_memcache}" == '1' ]; then
+  . include/memcached.sh
+  Install_pecl-memcache 2>&1 | tee -a ${oneinstack_dir}/install.log
+fi
+
+# pecl_redis
+if [ "${pecl_redis}" == '1' ]; then
+  . include/redis.sh
+  Install_pecl-redis 2>&1 | tee -a ${oneinstack_dir}/install.log
+fi
+
+# pecl_mongodb
+if [ -e "${mongo_install_dir}/bin/mongo" -o "${pecl_mongodb}" == '1' ]; then
+  . include/pecl_mongodb.sh
+  Install_pecl-mongodb 2>&1 | tee -a ${oneinstack_dir}/install.log
+fi
+
+# pecl_pgsql
+if [ -e "${pgsql_install_dir}/bin/psql" ]; then
+  . include/pecl_pgsql.sh
+  Install_pecl-pgsql 2>&1 | tee -a ${oneinstack_dir}/install.log
+fi
 
 # JDK
 case "${jdk_option}" in
@@ -948,30 +974,15 @@ fi
 if [ "${redis_yn}" == 'y' ]; then
   . include/redis.sh
   [ ! -d "${redis_install_dir}" ] && Install_redis-server 2>&1 | tee -a ${oneinstack_dir}/install.log
-  [ -e "${php_install_dir}/bin/phpize" ] && [ ! -e "$(${php_install_dir}/bin/php-config --extension-dir)/redis.so" ] && Install_php-redis 2>&1 | tee -a ${oneinstack_dir}/install.log
-fi
-
-if [ "${redis_pecl}" == '1' ]; then
-  . include/redis.sh
-  [ -e "${php_install_dir}/bin/phpize" ] && [ ! -e "$(${php_install_dir}/bin/php-config --extension-dir)/redis.so" ] && Install_php-redis 2>&1 | tee -a ${oneinstack_dir}/install.log
+  Install_pecl-redis 2>&1 | tee -a ${oneinstack_dir}/install.log
 fi
 
 # memcached
 if [ "${memcached_yn}" == 'y' ]; then
   . include/memcached.sh
   [ ! -d "${memcached_install_dir}/include/memcached" ] && Install_memcached 2>&1 | tee -a ${oneinstack_dir}/install.log
-  [ -e "${php_install_dir}/bin/phpize" ] && [ ! -e "$(${php_install_dir}/bin/php-config --extension-dir)/memcache.so" ] && Install_php-memcache 2>&1 | tee -a ${oneinstack_dir}/install.log
-  [ -e "${php_install_dir}/bin/phpize" ] && [ ! -e "$(${php_install_dir}/bin/php-config --extension-dir)/memcached.so" ] && Install_php-memcached 2>&1 | tee -a ${oneinstack_dir}/install.log
-fi
-
-if [ "${memcached_pecl}" == '1' ]; then
-  . include/memcached.sh
-  [ -e "${php_install_dir}/bin/phpize" ] && [ ! -e "$(${php_install_dir}/bin/php-config --extension-dir)/memcached.so" ] && Install_php-memcached 2>&1 | tee -a ${oneinstack_dir}/install.log
-fi
-
-if [ "${memcache_pecl}" == '1' ]; then
-  . include/memcached.sh
-  [ -e "${php_install_dir}/bin/phpize" ] && [ ! -e "$(${php_install_dir}/bin/php-config --extension-dir)/memcache.so" ] && Install_php-memcache 2>&1 | tee -a ${oneinstack_dir}/install.log
+  Install_pecl-memcached 2>&1 | tee -a ${oneinstack_dir}/install.log
+  Install_pecl-memcache 2>&1 | tee -a ${oneinstack_dir}/install.log
 fi
 
 # index example

+ 2 - 2
uninstall.sh

@@ -31,7 +31,7 @@ Usage(){
   printf "
 Usage: $0 [  ${CMSG}all${CEND} | ${CMSG}web${CEND} | ${CMSG}mysql${CEND} | ${CMSG}postgresql${CEND} | ${CMSG}mongodb${CEND} | ${CMSG}php${CEND} | ${CMSG}hhvm${CEND} | ${CMSG}pureftpd${CEND} | ${CMSG}redis${CEND} | ${CMSG}memcached${CEND} ]
 ${CMSG}all${CEND}            --->Uninstall All
-${CMSG}web${CEND}            --->Uninstall Nginx/Tengine/Apache/Tomcat
+${CMSG}web${CEND}            --->Uninstall Nginx/Tengine/OpenResty/Apache/Tomcat
 ${CMSG}mysql${CEND}          --->Uninstall MySQL/MariaDB/Percona/AliSQL
 ${CMSG}postgresql${CEND}     --->Uninstall PostgreSQL
 ${CMSG}mongodb${CEND}        --->Uninstall MongoDB
@@ -231,7 +231,7 @@ while :; do
   printf "
 What Are You Doing?
 \t${CMSG}0${CEND}. Uninstall All
-\t${CMSG}1${CEND}. Uninstall Nginx/Tengine/Apache/Tomcat
+\t${CMSG}1${CEND}. Uninstall Nginx/Tengine/OpenResty/Apache/Tomcat
 \t${CMSG}2${CEND}. Uninstall MySQL/MariaDB/Percona/AliSQL
 \t${CMSG}3${CEND}. Uninstall PostgreSQL
 \t${CMSG}4${CEND}. Uninstall MongoDB

+ 6 - 6
versions.txt

@@ -81,18 +81,18 @@ pureftpd_ver=1.0.47
 
 # Redis
 redis_ver=5.0.1
-redis_pecl_ver=4.1.1
+pecl_redis_ver=4.1.1
 
 # Memcached
 memcached_ver=1.5.12
 libmemcached_ver=1.0.18
-memcached_pecl_ver=2.2.0
-memcached_pecl_php7_ver=3.0.4
-memcache_pecl_ver=3.0.8
+pecl_memcached_ver=2.2.0
+pecl_memcached_php7_ver=3.0.4
+pecl_memcache_ver=3.0.8
 
 # MongoDB
-mongodb_pecl_ver=1.5.3
-mongo_pecl_ver=1.6.16
+pecl_mongodb_ver=1.5.3
+pecl_mongo_ver=1.6.16
 
 # phpMyadmin
 phpmyadmin_ver=4.8.3