diff --git a/plugins/php/versions/52/gd.sh b/plugins/php/versions/52/gd.sh new file mode 100755 index 000000000..4a05b6046 --- /dev/null +++ b/plugins/php/versions/52/gd.sh @@ -0,0 +1,107 @@ +#!/bin/bash +PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin +export PATH + +curPath=`pwd` + +rootPath=$(dirname "$curPath") +rootPath=$(dirname "$rootPath") +rootPath=$(dirname "$rootPath") +rootPath=$(dirname "$rootPath") +serverPath=$(dirname "$rootPath") +sourcePath=${serverPath}/source/php + +actionType=$1 +version=$2 + +LIBNAME=gd +LIBV=0 + +NON_ZTS_FILENAME=`ls $serverPath/php/${version}/lib/php/extensions | grep no-debug-non-zts` +extFile=$serverPath/php/${version}/lib/php/extensions/${NON_ZTS_FILENAME}/${LIBNAME}.so + +sysName=`uname` +if [ "$sysName" == "Darwin" ];then + BAK='_bak' +else + BAK='' +fi + +Install_lib() +{ + + isInstall=`cat $serverPath/php/$version/etc/php.ini|grep "${LIBNAME}.so"` + if [ "${isInstall}" != "" ];then + echo "php-$version 已安装${LIBNAME},请选择其它版本!" + return + fi + + ln -s /usr/lib64/libjpeg.so /usr/lib/libjpeg.so + ln -s /usr/lib64/libpng.so /usr/lib/ + cp -frp /usr/lib64/libldap* /usr/lib/ + + + if [ ! -f "$extFile" ];then + + if [ ! -d $sourcePath/php${version}/ext ];then + cd $serverPath/mdserver-web/plugins/php && /bin/bash install.sh install ${version} + fi + + cd $sourcePath/php${version}/ext/${LIBNAME} + + $serverPath/php/$version/bin/phpize + ./configure --with-php-config=$serverPath/php/$version/bin/php-config \ + --with-gd \ + --with-jpeg-dir=/usr/lib \ + --with-freetype-dir=${serverPath}/lib/freetype_old \ + --enable-gd-native-ttf \ + --enable-gd-jis-conv + + make clean && make && make install && make clean + + fi + + if [ ! -f "$extFile" ];then + echo "ERROR!" + return + fi + + echo "" >> $serverPath/php/$version/etc/php.ini + echo "[${LIBNAME}]" >> $serverPath/php/$version/etc/php.ini + echo "extension=${LIBNAME}.so" >> $serverPath/php/$version/etc/php.ini + + $serverPath/php/init.d/php${version} restart + echo '===========================================================' + echo 'successful!' +} + + +Uninstall_lib() +{ + if [ ! -f "$serverPath/php/$version/bin/php-config" ];then + echo "php-$version 未安装,请选择其它版本!" + return + fi + + if [ ! -f "$extFile" ];then + echo "php-$version 未安装${LIBNAME},请选择其它版本!" + return + fi + + echo $serverPath/php/$version/etc/php.ini + sed -i $BAK "/${LIBNAME}.so/d" $serverPath/php/$version/etc/php.ini + sed -i $BAK "/${LIBNAME}/d" $serverPath/php/$version/etc/php.ini + + rm -f $extFile + $serverPath/php/init.d/php$version reload + echo '===============================================' + echo 'successful!' +} + + + +if [ "$actionType" == 'install' ];then + Install_lib +elif [ "$actionType" == 'uninstall' ];then + Uninstall_lib +fi \ No newline at end of file diff --git a/plugins/php/versions/52/install.sh b/plugins/php/versions/52/install.sh index 4ad4443b3..cca6de044 100755 --- a/plugins/php/versions/52/install.sh +++ b/plugins/php/versions/52/install.sh @@ -116,19 +116,14 @@ if [ $sysName == 'Darwin' ]; then OPTIONS="${OPTIONS} --with-curl=${serverPath}/lib/curl" else OPTIONS="--with-iconv=${serverPath}/lib/libiconv" - OPTIONS="${OPTIONS} --with-freetype-dir=${serverPath}/lib/freetype_old" - OPTIONS="${OPTIONS} --with-gd --enable-gd-native-ttf" - OPTIONS="${OPTIONS} --with-jpeg-dir=/usr/lib" OPTIONS="${OPTIONS} --with-curl" fi if [ ! -d $serverPath/php/${PHP_VER} ];then - ln -s /usr/lib64/libjpeg.so /usr/lib/libjpeg.so - ln -s /usr/lib64/libpng.so /usr/lib/ - cp -frp /usr/lib64/libldap* /usr/lib/ - export MYSQL_LIB_DIR=/usr/lib64/mysql + export MYSQL_LIB_DIR=/usr/lib64/mysql + cd $sourcePath/php/php${PHP_VER} && ./configure \ --prefix=$serverPath/php/${PHP_VER} \ --exec-prefix=$serverPath/php/${PHP_VER} \ diff --git a/plugins/php/versions/phplib.conf b/plugins/php/versions/phplib.conf index 2f68212ce..55fb68527 100755 --- a/plugins/php/versions/phplib.conf +++ b/plugins/php/versions/phplib.conf @@ -143,6 +143,7 @@ { "name": "gd", "versions": [ + "52", "74", "80", "81"