This commit is contained in:
midoks
2019-11-30 18:02:21 +08:00
parent c0f37ceb08
commit ed6d8e0d34
11 changed files with 98 additions and 17 deletions
+5 -3
View File
@@ -19,12 +19,14 @@ echo "安装php-${version} ..." > $install_tmp
mkdir -p $sourcePath/php
mkdir -p $serverPath/php
if [ ! -d $sourcePath/php/php-src-php-${version} ];then
if [ ! -d $sourcePath/php/php74 ];then
wget --no-check-certificate -O $sourcePath/php/php-${version}.tar.gz https://github.com/php/php-src/archive/php-${version}.tar.gz
cd $sourcePath/php && tar zxvf $sourcePath/php/php-${version}.tar.gz
mv $sourcePath/php/php-src-php-${version} $sourcePath/php/php74
fi
cd $sourcePath/php/php-src-php-${version}
cd $sourcePath/php/php74
OPTIONS=''
if [ $sysName == 'Darwin' ]; then
@@ -48,7 +50,7 @@ fi
echo "$sourcePath/php/php-src-php-${version}"
if [ ! -d $serverPath/php/74 ];then
cd $sourcePath/php/php-src-php-${version}
cd $sourcePath/php/php74
./buildconf --force
./configure \
--prefix=$serverPath/php/74 \
+79
View File
@@ -0,0 +1,79 @@
#!/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=pcntl
LIBV=0
extFile=$serverPath/php/${version}/lib/php/extensions/no-debug-non-zts-20190902/${LIBNAME}.so
Install_lib()
{
isInstall=`cat $serverPath/php/$version/etc/php.ini|grep "${LIBNAME}.so"`
if [ "${isInstall}" != "" ];then
echo "php-$version 已安装${LIBNAME},请选择其它版本!"
return
fi
if [ ! -f "$extFile" ];then
cd $sourcePath/php74/ext/${LIBNAME}
$serverPath/php/$version/bin/phpize
./configure --with-php-config=$serverPath/php/$version/bin/php-config
make clean && make && make install && make clean
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 reload
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