mdserver-web/plugins/php/install.sh

98 lines
3.6 KiB
Bash
Raw Permalink Normal View History

2018-10-07 06:51:52 -04:00
#!/bin/bash
2023-11-08 12:32:59 -05:00
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin:/opt/homebrew/bin
2018-10-07 06:51:52 -04:00
export PATH
2018-11-26 00:57:06 -05:00
curPath=`pwd`
rootPath=$(dirname "$curPath")
rootPath=$(dirname "$rootPath")
serverPath=$(dirname "$rootPath")
2023-11-10 05:47:32 -05:00
sysName=`uname`
2018-11-26 00:57:06 -05:00
2025-09-14 03:51:47 -04:00
# cd /www/server/mdserver-web/plugins/php && bash install.sh install 73
2025-12-11 01:39:58 -05:00
# cd /www/server/mdserver-web/plugins/php && bash install.sh install 85
2025-08-18 13:03:40 -04:00
# https://www.php.net/releases
2022-06-10 05:53:23 -04:00
if id www &> /dev/null ;then
2022-11-21 09:08:12 -05:00
echo "www uid is `id -u www`"
echo "www shell is `grep "^www:" /etc/passwd |cut -d':' -f7 `"
2022-06-10 05:53:23 -04:00
else
groupadd www
2024-06-15 08:53:04 -04:00
useradd -g www -s /sbin/nologin www
# useradd -g www -s /bin/bash www
2022-06-10 05:53:23 -04:00
fi
2018-10-07 06:51:52 -04:00
2018-11-27 00:17:06 -05:00
action=$1
type=$2
2018-10-07 06:51:52 -04:00
2018-11-27 00:17:06 -05:00
if [ "${2}" == "" ];then
2024-11-24 14:20:54 -05:00
echo '缺少安装脚本...'
2018-11-27 00:17:06 -05:00
exit 0
fi
2018-10-07 06:51:52 -04:00
2018-11-27 00:17:06 -05:00
if [ ! -d $curPath/versions/$2 ];then
2024-11-24 14:20:54 -05:00
echo '缺少安装脚本2...'
2018-11-27 01:37:24 -05:00
exit 0
2018-10-07 06:51:52 -04:00
fi
2018-11-27 00:17:06 -05:00
2022-11-21 09:08:12 -05:00
2022-12-09 06:15:58 -05:00
# if [ "${action}" == "install" ] && [ -d $serverPath/php/${type} ];then
# exit 0
# fi
2022-11-18 11:46:08 -05:00
2022-06-28 13:13:33 -04:00
if [ "${action}" == "uninstall" ];then
2022-06-28 15:03:35 -04:00
2022-07-11 03:20:22 -04:00
if [ -f /usr/lib/systemd/system/php${type}.service ] || [ -f /lib/systemd/system/php${type}.service ] ;then
2022-06-28 13:39:03 -04:00
systemctl stop php${type}
2022-06-28 15:03:35 -04:00
systemctl disable php${type}
2022-07-03 10:17:45 -04:00
rm -rf /usr/lib/systemd/system/php${type}.service
2022-07-11 03:20:22 -04:00
rm -rf /lib/systemd/system/php${type}.service
2022-06-28 13:39:03 -04:00
systemctl daemon-reload
fi
2022-06-28 13:13:33 -04:00
fi
2022-06-28 13:57:06 -04:00
cd ${curPath} && sh -x $curPath/versions/$2/install.sh $1
2022-06-28 13:13:33 -04:00
2022-06-30 00:57:20 -04:00
if [ "${action}" == "install" ] && [ -d ${serverPath}/php/${type} ];then
2022-11-16 06:31:11 -05:00
2022-11-19 04:42:59 -05:00
#初始化
cd ${rootPath} && python3 ${rootPath}/plugins/php/index.py start ${type}
cd ${rootPath} && python3 ${rootPath}/plugins/php/index.py initd_install ${type}
2022-11-16 06:31:11 -05:00
# 安装通用扩展
2022-11-16 07:13:50 -05:00
echo "install PHP${type} extend start"
2022-12-02 09:54:35 -05:00
2022-12-02 10:25:54 -05:00
# cd /www/server/mdserver-web/plugins/php/versions/common && bash iconv.sh install 53
2023-06-13 13:21:47 -04:00
# cd /www/server/mdserver-web/plugins/php/versions/common && bash intl.sh install 73
2022-12-02 09:54:35 -05:00
# cd /www/server/mdserver-web/plugins/php/versions/common && bash gd.sh install 56
# cd /www/server/mdserver-web/plugins/php/versions/common && bash openssl.sh install 56
2024-04-17 00:34:07 -04:00
# cd /www/server/mdserver-web/plugins/php/versions/common && bash fileinfo.sh install 81
2026-04-10 05:29:14 -04:00
# cd /www/server/mdserver-web/plugins/php/versions/common && bash pgsql.sh install 84
2026-04-10 05:31:20 -04:00
# cd /www/server/mdserver-web/plugins/php/versions/common && bash pdo_pgsql.sh install 84
2024-11-28 12:08:08 -05:00
cd ${rootPath}/plugins/php/versions/common && bash curl.sh install ${type}
2022-11-16 07:13:50 -05:00
cd ${rootPath}/plugins/php/versions/common && bash gd.sh install ${type}
2024-11-28 14:55:03 -05:00
cd ${rootPath}/plugins/php/versions/common && bash readline.sh install ${type}
2022-11-16 07:13:50 -05:00
cd ${rootPath}/plugins/php/versions/common && bash iconv.sh install ${type}
cd ${rootPath}/plugins/php/versions/common && bash exif.sh install ${type}
cd ${rootPath}/plugins/php/versions/common && bash intl.sh install ${type}
cd ${rootPath}/plugins/php/versions/common && bash mcrypt.sh install ${type}
cd ${rootPath}/plugins/php/versions/common && bash openssl.sh install ${type}
cd ${rootPath}/plugins/php/versions/common && bash bcmath.sh install ${type}
2022-11-16 07:13:50 -05:00
cd ${rootPath}/plugins/php/versions/common && bash gettext.sh install ${type}
2022-11-18 10:15:28 -05:00
cd ${rootPath}/plugins/php/versions/common && bash redis.sh install ${type}
cd ${rootPath}/plugins/php/versions/common && bash memcached.sh install ${type}
2024-11-25 14:46:00 -05:00
cd ${rootPath}/plugins/php/versions/common && bash pcntl.sh install ${type}
2024-12-09 10:29:57 -05:00
cd ${rootPath}/plugins/php/versions/common && bash zip.sh install ${type}
cd ${rootPath}/plugins/php/versions/common && bash zlib.sh install ${type}
2022-12-09 06:49:24 -05:00
2022-11-16 07:13:50 -05:00
echo "install PHP${type} extend end"
2022-12-17 10:50:21 -05:00
2023-11-10 05:47:32 -05:00
if [ ! -f /usr/local/bin/composer ] && [ "$sysName" != "Darwin" ] ;then
2022-12-17 10:50:21 -05:00
cd /tmp
2023-01-09 02:10:14 -05:00
curl -sS https://getcomposer.org/installer | /www/server/php/${type}/bin/php
2022-12-17 10:50:21 -05:00
mv composer.phar /usr/local/bin/composer
fi
2022-06-28 13:13:33 -04:00
fi