Browse Source

Add php7 redis,memcached,imagick extension

lj2007331 9 years ago
parent
commit
03eb88f8d4
5 changed files with 55 additions and 39 deletions
  1. 1 1
      apps.conf
  2. 9 3
      include/ImageMagick.sh
  3. 9 4
      include/memcached.sh
  4. 8 3
      include/redis.sh
  5. 28 28
      install.sh

+ 1 - 1
apps.conf

@@ -14,7 +14,7 @@ apr_util_version=1.5.4
 
 # DB
 mysql_5_7_version=5.7.9
-mysql_5_6_version=5.6.27
+mysql_5_6_version=5.6.28
 mysql_5_5_version=5.5.46
 
 mariadb_10_1_version=10.1.9

+ 9 - 3
include/ImageMagick.sh

@@ -24,9 +24,15 @@ cd ..
 Install_php-imagick() {
 cd $oneinstack_dir/src
 if [ -e "$php_install_dir/bin/phpize" ];then
-    src_url=http://pecl.php.net/get/imagick-$imagick_version.tgz && Download_src
-    tar xzf imagick-$imagick_version.tgz
-    cd imagick-$imagick_version
+    if [ "`$php_install_dir/bin/php -r 'echo PHP_VERSION;' | awk -F. '{print $1}'`" == '7' ];then
+        src_url=https://pecl.php.net/get/imagick-3.4.0RC2.tgz && Download_src
+        tar xzf imagick-3.4.0RC2.tgz
+        cd imagick-3.4.0RC2
+    else
+        src_url=http://pecl.php.net/get/imagick-$imagick_version.tgz && Download_src
+        tar xzf imagick-$imagick_version.tgz
+        cd imagick-$imagick_version
+    fi
     make clean
     export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
     $php_install_dir/bin/phpize

+ 9 - 4
include/memcached.sh

@@ -46,7 +46,7 @@ cd ..
 
 Install_php-memcache() {
 cd $oneinstack_dir/src
-if [ -e "$php_install_dir/bin/phpize" ];then
+if [ -e "$php_install_dir/bin/phpize" ] && [ "`$php_install_dir/bin/php -r 'echo PHP_VERSION;' | awk -F. '{print $1}'`" == '5' ];then
     src_url=http://pecl.php.net/get/memcache-$memcache_pecl_version.tgz && Download_src
     # php memcache extension
     tar xzf memcache-$memcache_pecl_version.tgz 
@@ -73,7 +73,6 @@ Install_php-memcached() {
 cd $oneinstack_dir/src
 if [ -e "$php_install_dir/bin/phpize" ];then
     src_url=https://launchpad.net/libmemcached/1.0/$libmemcached_version/+download/libmemcached-$libmemcached_version.tar.gz && Download_src
-    src_url=http://pecl.php.net/get/memcached-$memcached_pecl_version.tgz && Download_src
     # php memcached extension
     tar xzf libmemcached-$libmemcached_version.tar.gz
     cd libmemcached-$libmemcached_version
@@ -85,8 +84,14 @@ if [ -e "$php_install_dir/bin/phpize" ];then
     cd ..
     rm -rf libmemcached-$libmemcached_version
 
-    tar xzf memcached-$memcached_pecl_version.tgz
-    cd memcached-$memcached_pecl_version
+    if [ "`$php_install_dir/bin/php -r 'echo PHP_VERSION;' | awk -F. '{print $1}'`" == '7' ];then
+        git clone -b php7 https://github.com/php-memcached-dev/php-memcached.git 
+        cd php-memcached 
+    else
+        src_url=http://pecl.php.net/get/memcached-$memcached_pecl_version.tgz && Download_src
+        tar xzf memcached-$memcached_pecl_version.tgz
+        cd memcached-$memcached_pecl_version
+    fi
     make clean
     $php_install_dir/bin/phpize
     ./configure --with-php-config=$php_install_dir/bin/php-config

+ 8 - 3
include/redis.sh

@@ -58,9 +58,14 @@ cd ..
 Install_php-redis() {
 cd $oneinstack_dir/src
 if [ -e "$php_install_dir/bin/phpize" ];then
-    src_url=http://pecl.php.net/get/redis-$redis_pecl_version.tgz && Download_src
-    tar xzf redis-$redis_pecl_version.tgz
-    cd redis-$redis_pecl_version
+    if [ "`$php_install_dir/bin/php -r 'echo PHP_VERSION;' | awk -F. '{print $1}'`" == '7' ];then
+        git clone -b php7 https://github.com/phpredis/phpredis.git
+        cd phpredis
+    else
+        src_url=http://pecl.php.net/get/redis-$redis_pecl_version.tgz && Download_src
+        tar xzf redis-$redis_pecl_version.tgz
+        cd redis-$redis_pecl_version
+    fi
     make clean
     $php_install_dir/bin/phpize
     ./configure --with-php-config=$php_install_dir/bin/php-config

+ 28 - 28
install.sh

@@ -350,7 +350,7 @@ do
                         done
                     fi
         
-                    if [ "$PHP_version" != '5' ];then
+                    # ImageMagick or GraphicsMagick
                     while :
                     do
                         echo
@@ -361,8 +361,8 @@ do
                             break
                         fi
                     done
-                    fi
-                    if [ "$Magick_yn" == 'y' ];then
+
+                    if [ "$Magick_yn" == 'y' ] && [ "$PHP_version" != '5' ];then
                         while :
                         do
                             echo 'Please select ImageMagick or GraphicsMagick:'
@@ -376,6 +376,8 @@ do
                                 break
                             fi
                         done
+                    elif [ "$Magick_yn" == 'y' ] && [ "$PHP_version" == '5' ];then
+                        Magick=1
                     fi
                     break
                 fi
@@ -413,31 +415,29 @@ if [[ $PHP_version =~ ^[1-5]$ ]] || [ -e "$php_install_dir/bin/phpize" ];then
     done
 fi
 
-if [ "$PHP_version" != '5' ];then
-    # check redis
-    while :
-    do
-        echo
-        read -p "Do you want to install redis? [y/n]: " redis_yn
-        if [[ ! $redis_yn =~ ^[y,n]$ ]];then
-            echo "${CWARNING}input error! Please only input 'y' or 'n'${CEND}"
-        else
-            break
-        fi
-    done
-    
-    # check memcached
-    while :
-    do
-        echo
-        read -p "Do you want to install memcached? [y/n]: " memcached_yn
-        if [[ ! $memcached_yn =~ ^[y,n]$ ]];then
-            echo "${CWARNING}input error! Please only input 'y' or 'n'${CEND}"
-        else
-            break
-        fi
-    done
-fi
+# check redis
+while :
+do
+    echo
+    read -p "Do you want to install redis? [y/n]: " redis_yn
+    if [[ ! $redis_yn =~ ^[y,n]$ ]];then
+        echo "${CWARNING}input error! Please only input 'y' or 'n'${CEND}"
+    else
+        break
+    fi
+done
+
+# check memcached
+while :
+do
+    echo
+    read -p "Do you want to install memcached? [y/n]: " memcached_yn
+    if [[ ! $memcached_yn =~ ^[y,n]$ ]];then
+        echo "${CWARNING}input error! Please only input 'y' or 'n'${CEND}"
+    else
+        break
+    fi
+done
 
 # check jemalloc or tcmalloc 
 if [ "$Nginx_version" == '1' -o "$Nginx_version" == '2' -o "$DB_yn" == 'y' ];then