Merge pull request #118 from midoks/dev

[@soxft]重写向和反代功能
This commit is contained in:
Mr Chen
2022-07-03 19:41:13 +08:00
committed by GitHub
314 changed files with 3548 additions and 1066 deletions
+38
View File
@@ -0,0 +1,38 @@
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
name: MW APP MySQL55
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
permissions:
contents: read
jobs:
build:
strategy:
matrix:
os: [ubuntu-20.04, ubuntu-18.04, ubuntu-22.04]
runs-on: ${{ matrix.os }}
#runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.10
uses: actions/setup-python@v3
with:
python-version: "3.10"
- name: Install MW
run: |
sudo bash scripts/install_dev.sh
- name: Install MySQL55
run: |
cd /www/server/mdserver-web/plugins/mysql && sudo bash install.sh install 5.5
- name: Start DEBUG
run: |
gunicorn -c setting.py app:app
python3 task.py &
+38
View File
@@ -0,0 +1,38 @@
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
name: MW APP MySQL56
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
permissions:
contents: read
jobs:
build:
strategy:
matrix:
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
#runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.10
uses: actions/setup-python@v3
with:
python-version: "3.10"
- name: Install MW
run: |
sudo bash scripts/install_dev.sh
- name: Install MySQL56
run: |
cd /www/server/mdserver-web/plugins/mysql && sudo bash install.sh install 5.6
- name: Start DEBUG
run: |
gunicorn -c setting.py app:app
python3 task.py &
+38
View File
@@ -0,0 +1,38 @@
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
name: MW APP MySQL57
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
permissions:
contents: read
jobs:
build:
strategy:
matrix:
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
#runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.10
uses: actions/setup-python@v3
with:
python-version: "3.10"
- name: Install MW
run: |
sudo bash scripts/install_dev.sh
- name: Install MySQL57
run: |
cd /www/server/mdserver-web/plugins/mysql && sudo bash install.sh install 5.7
- name: Start DEBUG
run: |
gunicorn -c setting.py app:app
python3 task.py &
+1
View File
@@ -142,3 +142,4 @@ data/edate.pl
plugins/l2tp
plugins/openlitespeed
plugins/gdrive
debug.out
+3 -1
View File
@@ -37,11 +37,13 @@
# Note
```
phpMyAdmin[4.4.15]支持MySQL[5.5-5.7]
phpMyAdmin[5.2.0]支持MySQL[8.0]
PHP[53-72]支持phpMyAdmin[4.4.15]
PHP[72-81]支持phpMyAdmin[5.2.0]
```
@@ -83,7 +85,7 @@ curl -fsSL https://gitee.com/midoks/mdserver-web/raw/master/scripts/update_cn.s
### 通用安装
```
curl -fsSL https://raw.githubusercontent.com/midoks/mdserver-web/master/scripts/quick/app.sh | bash
curl -fsSL https://raw.githubusercontent.com/midoks/mdserver-web/dev/scripts/quick/app.sh | bash
```
+5
View File
@@ -1,5 +1,10 @@
# coding:utf-8
# pip install profiler_online
# 性能测试
# from profiler_online import run_profiler
# run_profiler()
from gevent import monkey
monkey.patch_all()
+1 -1
View File
@@ -18,7 +18,7 @@ class config_api:
# 本版解决自启动问题
# 文件管理重命名
# 优化计划任务管理
__version = '0.8.6.1'
__version = '0.8.6.2'
def __init__(self):
pass
+1 -3
View File
@@ -210,7 +210,6 @@ class files_api:
try:
name = mw.M('tasks').where('id=?', (mid,)).getField('name')
status = mw.M('tasks').where('id=?', (mid,)).getField('status')
# print(name, status)
mw.M('tasks').delete(mid)
if status == '-1':
task_pid = mw.execShell(
@@ -220,8 +219,7 @@ class files_api:
for i in range(len(task_list)):
self.removeTaskRecursion(task_list[i])
isTask = mw.getRootDir() + '/tmp/panelTask.pl'
mw.writeFile(isTask, 'True')
mw.triggerTask()
system_api.system_api().restartTask()
except:
system_api.system_api().restartTask()
+24 -10
View File
@@ -88,6 +88,11 @@ def setBackupDir(bdir):
return writeFile(file, bdir)
def triggerTask():
isTask = getRunDir() + '/tmp/panelTask.pl'
writeFile(isTask, 'True')
def getOs():
return sys.platform
@@ -592,20 +597,29 @@ def getLocalIpBack():
def getLocalIp():
# 取本地外网IP
filename = 'data/iplist.txt'
try:
import re
filename = 'data/iplist.txt'
ipaddress = readFile(filename)
if not ipaddress or ipaddress == '127.0.0.1':
import urllib
url = 'https://v6r.ipip.net/?format=text'
req = urllib.request.urlopen(url, timeout=10)
ipaddress = req.read().decode('utf-8')
writeFile(filename, ipaddress)
raise
return ipaddress
except Exception as ex:
return '127.0.0.1'
except Exception as e:
cmd = "curl -4 -sS --connect-timeout 5 -m 60 https://v6r.ipip.net/?format=text"
ip = execShell(cmd)
result = ip[0].strip()
if result == '':
raise
writeFile(filename, result)
return result
except Exception as e:
cmd = "curl -6 -sS --connect-timeout 5 -m 60 https://v6r.ipip.net/?format=text"
ip = execShell(cmd)
result = ip[0].strip()
if result == '':
return '127.0.0.1'
writeFile(filename, result)
return result
return '127.0.0.1'
def inArray(arrays, searchStr):
+2 -3
View File
@@ -125,8 +125,7 @@ class plugins_api:
mw.M('tasks').add('id,name,type,status,addtime, execstr', taskAdd)
# 任务执行相关
isTask = mw.getRootDir() + '/tmp/panelTask.pl'
mw.writeFile(isTask, 'True')
mw.triggerTask()
return mw.returnJson(True, '已将安装任务添加到队列!')
def uninstallOldApi(self):
@@ -795,7 +794,7 @@ class plugins_api:
return mw.returnJson(True, '删除成功!')
# shell 调用
def run(self, name, func, version, args='', script='index'):
def run(self, name, func, version='', args='', script='index'):
path = mw.getRunDir() + '/' + self.__plugin_dir + \
'/' + name + '/' + script + '.py'
py = 'python3 ' + path
+260 -25
View File
@@ -3,6 +3,7 @@
import time
import os
import sys
from urllib.parse import urlparse
import mw
import re
import json
@@ -44,6 +45,11 @@ class site_api:
mw.execShell("mkdir -p " + self.redirectPath +
" && chmod -R 755 " + self.redirectPath)
self.proxyPath = self.setupPath + '/nginx/proxy'
if not os.path.exists(self.proxyPath):
mw.execShell("mkdir -p " + self.proxyPath +
" && chmod -R 755 " + self.proxyPath)
self.logsPath = mw.getRootDir() + '/wwwlogs'
# ssl conf
if mw.isAppleSystem():
@@ -287,7 +293,7 @@ class site_api:
domains.append(tmp)
data['domains'] = domains
data['email'] = mw.M('users').getField('email')
if data['email'] == '287962566@qq.com':
if data['email'] == 'midoks@163.com':
data['email'] = ''
return mw.returnJson(True, 'OK', data)
@@ -574,9 +580,12 @@ class site_api:
file = self.getHostConf(siteName)
if os.path.exists(file):
siteConf = mw.readFile(file)
if siteConf.find('301-START') != -1:
if siteConf.find('301-END') != -1:
return mw.returnJson(False, '检测到您的站点做了301重定向设置,请先关闭重定向!')
if siteConf.find('PROXY-END') != -1:
return mw.returnJson(False, '检测到您的站点做了反向代理设置,请先关闭反向代理!')
letpath = self.sslDir + siteName
csrpath = letpath + "/fullchain.pem" # 生成证书路径
keypath = letpath + "/privkey.pem" # 密钥文件路径
@@ -780,6 +789,10 @@ class site_api:
siteName = request.form.get('siteName', '')
return self.getLogs(siteName)
def getErrorLogsApi(self):
siteName = request.form.get('siteName', '')
return self.getErrorLogs(siteName)
def getSitePhpVersionApi(self):
siteName = request.form.get('siteName', '')
return self.getSitePhpVersion(siteName)
@@ -823,6 +836,30 @@ class site_api:
port = request.form.get('port', '')
return self.add(webname, port, ps, path, version)
def checkWebStatusApi(self):
'''
创建站点检查web服务
'''
if not mw.isInstalledWeb():
return mw.returnJson(False, '请安装并启动OpenResty服务!')
# 这个快点
pid = mw.getServerDir() + '/openresty/nginx/logs/nginx.pid'
if not os.path.exists(pid):
return mw.returnJson(False, '请启动OpenResty服务!')
# path = mw.getServerDir() + '/openresty/init.d/openresty'
# data = mw.execShell(path + " status")
# if data[0].strip().find('stopped') != -1:
# return mw.returnJson(False, '请启动OpenResty服务!')
# import plugins_api
# data = plugins_api.plugins_api().run('openresty', 'status')
# if data[0].strip() == 'stop':
# return mw.returnJson(False, '请启动OpenResty服务!')
return mw.returnJson(True, 'OK')
def addDomainApi(self):
isError = mw.checkWebConfig()
if isError != True:
@@ -1075,7 +1112,7 @@ class site_api:
# self.closeHasPwd(get)
filename = self.passPath + '/' + siteName + '.pass'
print(filename)
# print(filename)
passconf = username + ':' + mw.hasPwd(password)
if siteName == 'phpmyadmin':
@@ -1176,6 +1213,31 @@ class site_api:
path = request.form.get('path', '0')
return self.delete(sid, webname, path)
# 操作 重定向配置
def operateRedirectConf(self, siteName, method='start'):
vhost_file = self.vhostPath + '/' + siteName + '.conf'
content = mw.readFile(vhost_file)
cnf_301 = '''
#301-START
include %s/*.conf;
#301-END
''' % (self.getRedirectPath( siteName))
cnf_301_source = '''
#301-START
'''
# print('operateRedirectConf', content.find('#301-END'))
if content.find('#301-END') != -1:
if method == 'stop':
rep = '#301-START(\n|.){1,500}#301-END'
content = re.sub(rep, '#301-START', content)
else:
if method == 'start':
content = re.sub(cnf_301_source, cnf_301, content)
mw.writeFile(vhost_file, content)
# get_redirect_status
def getRedirectApi(self):
_siteName = request.form.get("siteName", '')
@@ -1230,8 +1292,9 @@ class site_api:
if rule_test != True:
mw.writeFile("{}/{}/{}.conf".format(self.redirectPath,
_siteName, _id), _old_config)
return mw.returnJson(False, "Nginx 配置测试不通过, 请重试: {}".format(rule_test))
return mw.returnJson(False, "OpenResty 配置测试不通过, 请重试: {}".format(rule_test))
self.operateRedirectConf(_siteName, 'start')
mw.restartWeb()
return mw.returnJson(True, "ok")
@@ -1309,6 +1372,8 @@ class site_api:
mw.writeFile(data_path, json.dumps(data))
mw.writeFile(
"{}/{}.conf".format(self.getRedirectPath(_siteName), _id), file_content)
self.operateRedirectConf(_siteName, 'start')
mw.restartWeb()
return mw.returnJson(True, "ok")
@@ -1330,6 +1395,9 @@ class site_api:
break
# write database
mw.writeFile(data_path, json.dumps(data))
# data is empty ,should stop
if len(data) == 0:
self.operateRedirectConf(_siteName, 'stop')
# remove conf file
mw.execShell(
"rm -rf {}/{}.conf".format(self.getRedirectPath(_siteName), _id))
@@ -1337,21 +1405,161 @@ class site_api:
return mw.returnJson(False, "删除失败!")
return mw.returnJson(True, "删除成功!")
def getProxyListApi(self):
siteName = request.form.get('siteName', '')
conf_path = self.getHostConf(siteName)
old_conf = mw.readFile(conf_path)
rep = "(#PROXY-START(\n|.)+#PROXY-END)"
url_rep = "proxy_pass (.*);|ProxyPass\s/\s(.*)|Host\s(.*);"
host_rep = "Host\s(.*);"
# 操作 反向代理配置
def operateProxyConf(self, siteName, method='start'):
vhost_file = self.vhostPath + '/' + siteName + '.conf'
content = mw.readFile(vhost_file)
proxyUrl = self.__read_config(self.__proxyfile)
sitename = sitename
proxylist = []
for i in proxyUrl:
if i["sitename"] == sitename:
proxylist.append(i)
return mw.getJson(proxylist)
proxy_cnf = '''
#PROXY-START
include %s/*.conf;
#PROXY-END
''' % (self.getProxyPath(siteName))
proxy_cnf_source = '''
#PROXY-START
'''
if content.find('#PROXY-END') != -1:
if method == 'stop':
rep = '#PROXY-START(\n|.){1,500}#PROXY-END'
content = re.sub(rep, '#PROXY-START', content)
else:
if method == 'start':
content = re.sub(proxy_cnf_source, proxy_cnf, content)
mw.writeFile(vhost_file, content)
# 读取 网站 反向代理列表
def getProxyListApi(self):
_siteName = request.form.get('siteName', '')
data_path = self.getProxytDataPath(_siteName)
data_content = mw.readFile(data_path)
# not exists
if data_content == False:
mw.execShell("mkdir {}/{}".format(self.proxyPath, _siteName))
return mw.returnJson(True, "", {"result": [], "count": 0})
try:
data = json.loads(data_content)
except:
mw.execShell("rm -rf {}/{}".format(self.proxyPath, _siteName))
return mw.returnJson(True, "", {"result": [], "count": 0})
return mw.returnJson(True, "ok", {"result": data, "count": len(data)})
# 设置 网站 反向代理列表
def setProxyApi(self):
_siteName = request.form.get('siteName', '')
_from = request.form.get('from', '')
_to = request.form.get('to', '')
_host = request.form.get('host', '')
if _siteName == "" or _from == "" or _to == "" or _host == "":
return mw.returnJson(False, "必填项不能为空")
data_path = self.getProxytDataPath(_siteName)
data_content = mw.readFile(
data_path) if os.path.exists(data_path) else ""
data = json.loads(data_content) if data_content != "" else []
rep = "http(s)?\:\/\/([a-zA-Z0-9][-a-zA-Z0-9]{0,62}\.)+([a-zA-Z0-9][a-zA-Z0-9]{0,62})+.?"
if not re.match(rep, _to):
return mw.returnJson(False, "错误的目标地址!")
# get host from url
try:
if _host == "$host":
host_tmp = urlparse(_to)
_host = host_tmp.netloc
except:
return mw.returnJson(False, "错误的目标地址")
tpl = """
#PROXY-START/
location ~* \.(gif|png|jpg|css|js|woff|woff2)$
{
proxy_pass {to};
proxy_set_header Host {host};
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header REMOTE-HOST $remote_addr;
expires 12h;
}
location ~* ^{from}(.*)$ {
proxy_pass {to};
proxy_set_header Host {host};
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header REMOTE-HOST $remote_addr;
add_header X-Cache $upstream_cache_status;
proxy_ignore_headers Set-Cookie Cache-Control expires;
add_header Cache-Control no-cache;
}
#PROXY-END/
"""
# replace
if _from[0] != '/':
_from = '/' + _from
tpl = tpl.replace("{from}", _from, 999)
tpl = tpl.replace("{to}", _to)
tpl = tpl.replace("{host}", _host, 999)
_id = mw.md5("{}+{}+{}".format(_from, _to, _siteName))
for item in data:
if item["id"] == _id:
return mw.returnJson(False, "已存在该规则!")
if item["from"] == _from:
return mw.returnJson(False, "已存在该规则!")
data.append({
"from": _from,
"to": _to,
"host": _host,
"id": _id
})
mw.writeFile(data_path, json.dumps(data))
mw.writeFile(
"{}/{}.conf".format(self.getProxyPath(_siteName), _id), tpl)
self.operateProxyConf(_siteName, 'start')
mw.restartWeb()
return mw.returnJson(True, "ok", {
"hash": _id
})
def delProxyApi(self):
_siteName = request.form.get("siteName", '')
_id = request.form.get("id", '')
if _id == '' or _siteName == '':
return mw.returnJson(False, "必填项不能为空!")
try:
data_path = self.getProxytDataPath(_siteName)
data_content = mw.readFile(
data_path) if os.path.exists(data_path) else ""
data = json.loads(data_content) if data_content != "" else []
for item in data:
if item["id"] == _id:
data.remove(item)
break
# write database
mw.writeFile(data_path, json.dumps(data))
# data is empty,should stop
if len(data) == 0:
self.operateProxyConf(_siteName, 'stop')
# remove conf file
mw.execShell(
"rm -rf {}/{}.conf".format(self.getProxyPath(_siteName), _id))
except:
return mw.returnJson(False, "删除失败!")
mw.restartWeb()
return mw.returnJson(True, "删除成功!")
def getSiteTypesApi(self):
# 取网站分类
@@ -1508,7 +1716,13 @@ class site_api:
return "{}/{}/data.json".format(self.redirectPath, siteName)
def getRedirectPath(self, siteName):
return "{}/{}/".format(self.redirectPath, siteName)
return "{}/{}".format(self.redirectPath, siteName)
def getProxytDataPath(self, siteName):
return "{}/{}/data.json".format(self.proxyPath, siteName)
def getProxyPath(self, siteName):
return "{}/{}".format(self.proxyPath, siteName)
def getDirBindRewrite(self, siteName, dirname):
return self.rewritePath + '/' + siteName + '_' + dirname + '.conf'
@@ -1527,6 +1741,12 @@ class site_api:
return mw.returnJson(False, '日志为空')
return mw.returnJson(True, mw.getNumLines(logPath, 100))
def getErrorLogs(self, siteName):
logPath = mw.getLogsDir() + '/' + siteName + '.error.log'
if not os.path.exists(logPath):
return mw.returnJson(False, '日志为空')
return mw.returnJson(True, mw.getNumLines(logPath, 100))
# 取日志状态
def getLogsStatus(self, siteName):
filename = self.getHostConf(siteName)
@@ -1766,10 +1986,10 @@ class site_api:
def createRootDir(self, path):
if not os.path.exists(path):
os.makedirs(path)
if not mw.isAppleSystem():
mw.execShell('chown -R www:www ' + path)
mw.writeFile(path + '/index.html', 'Work has started!!!')
mw.execShell('chmod -R 755 ' + path)
if not mw.isAppleSystem():
mw.execShell('chown -R www:www ' + path)
mw.writeFile(path + '/index.html', 'Work has started!!!')
mw.execShell('chmod -R 755 ' + path)
def nginxAddDomain(self, webname, domain, port):
file = self.getHostConf(webname)
@@ -1807,7 +2027,8 @@ class site_api:
content = content.replace('{$PHP_DIR}', self.setupPath + '/php')
content = content.replace('{$PHPVER}', self.phpVersion)
content = content.replace('{$OR_REWRITE}', self.rewritePath)
content = content.replace('{$OR_REDIRECT}', self.redirectPath)
# content = content.replace('{$OR_REDIRECT}', self.redirectPath)
# content = content.replace('{$OR_PROXY}', self.proxyPath)
logsPath = mw.getLogsDir()
content = content.replace('{$LOGPATH}', logsPath)
@@ -1815,6 +2036,10 @@ class site_api:
rewrite_content = '''
location /{
if ($PHP_ENV != "1"){
break;
}
if (!-e $request_filename) {
rewrite ^(.*)$ /index.php/$1 last;
break;
@@ -1869,18 +2094,28 @@ location /{
errLogPath = mw.getLogsDir() + '/' + webname + '.error.log'
confFile = self.setupPath + '/nginx/vhost/' + webname + '.conf'
rewriteFile = self.setupPath + '/nginx/rewrite/' + webname + '.conf'
rewriteFile = self.setupPath + '/nginx/pass/' + webname + '.conf'
passFile = self.setupPath + '/nginx/pass/' + webname + '.conf'
keyPath = self.sslDir + webname + '/privkey.pem'
certPath = self.sslDir + webname + '/fullchain.pem'
logs = [assLogPath,
errLogPath,
confFile,
rewriteFile,
passFile,
keyPath,
certPath]
for i in logs:
mw.deleteFile(i)
# 重定向目录
redirectDir = self.setupPath + '/nginx/redirect/' + webname
if os.path.exists(redirectDir):
mw.execShell('rm -rf ' + redirectDir)
# 代理目录
proxyDir = self.setupPath + '/nginx/proxy/' + webname
if os.path.exists(proxyDir):
mw.execShell('rm -rf ' + proxyDir)
def delete(self, sid, webname, path):
self.deleteWSLogs(webname)
if path == '1':
+7 -2
View File
@@ -18,7 +18,6 @@ mw_start(){
mw_start_debug(){
python3 task.py >> $DIR/logs/task.log 2>&1 &
gunicorn -b :7200 -k gevent -w 1 app:app
}
@@ -36,7 +35,13 @@ mw_stop()
do
kill -9 $i
done
ps -ef|grep task.py |grep -v grep|awk '{print $2}'|xargs kill -9
pids=`ps -ef|grep task.py | grep -v grep |awk '{print $2}'`
arr=($pids)
for p in ${arr[@]}
do
kill -9 $p
done
}
case "$1" in
+5 -4
View File
@@ -8,6 +8,10 @@ server
#SSL-START
#error_page 404/404.html;
#SSL-END
#301-START
#PROXY-START
#ERROR-PAGE-START
error_page 404 /404.html;
@@ -21,10 +25,7 @@ server
#REWRITE-START
include {$OR_REWRITE}/{$SERVER_NAME}.conf;
#REWRITE-END
#301-START
include {$OR_REDIRECT}/{$SERVER_NAME}/*.conf;
##301-END
#禁止访问的文件或目录
location ~ ^/(\.user.ini|\.htaccess|\.git|\.svn|\.project|LICENSE|README.md)
Binary file not shown.

Before

Width:  |  Height:  |  Size: 463 B

After

Width:  |  Height:  |  Size: 254 B

+17 -77
View File
@@ -104,80 +104,41 @@ def initDreplace():
return file_bin
def start():
def mgOp(method):
file = initDreplace()
if mw.isAppleSystem():
file = initDreplace()
data = mw.execShell(file + ' start')
data = mw.execShell(file + ' ' + method)
if data[1] == '':
return 'ok'
return 'fail'
return data[1]
cmd = 'systemctl start mongod'
cmd = 'systemctl ' + method + ' mongod'
if os.path.exists("/usr/lib/systemd/system/mongodb.service"):
cmd = 'systemctl start mongodb'
cmd = 'systemctl ' + start + ' mongodb'
data = mw.execShell(cmd)
if data[1] == '':
return 'ok'
return 'fail'
return data[1]
def start():
return mgOp('start')
def stop():
if mw.isAppleSystem():
file = initDreplace()
data = mw.execShell(file + ' stop')
if data[1] == '':
return 'ok'
return 'fail'
cmd = 'systemctl stop mongod'
if os.path.exists("/usr/lib/systemd/system/mongodb.service"):
cmd = 'systemctl stop mongodb'
data = mw.execShell(cmd)
if data[1] == '':
return 'ok'
return 'fail'
return mgOp('stop')
def reload():
if os.path.exists("/tmp/mongodb-27017.sock"):
mw.execShell('rm -rf ' + "/tmp/mongodb-27017.sock")
if mw.isAppleSystem():
file = initDreplace()
data = mw.execShell(file + ' reload')
if data[1] == '':
return 'ok'
return 'fail'
cmd = 'systemctl reload mongod'
if os.path.exists("/usr/lib/systemd/system/mongodb.service"):
cmd = 'systemctl reload mongodb'
data = mw.execShell(cmd)
if data[1] == '':
return 'ok'
return 'fail'
return mgOp('reload')
def restart():
if os.path.exists("/tmp/mongodb-27017.sock"):
mw.execShell('rm -rf ' + "/tmp/mongodb-27017.sock")
if mw.isAppleSystem():
file = initDreplace()
data = mw.execShell(file + ' reload')
if data[1] == '':
return 'ok'
return 'fail'
cmd = 'systemctl reload mongod'
if os.path.exists("/usr/lib/systemd/system/mongodb.service"):
cmd = 'systemctl reload mongodb'
data = mw.execShell(cmd)
if data[1] == '':
return 'ok'
return 'fail'
return mgOp('restart')
def runInfo():
@@ -218,15 +179,8 @@ def runInfo():
def initdStatus():
if not app_debug:
if mw.isAppleSystem():
return "Apple Computer does not support"
if mw.isAppleSystem():
initd_bin = getInitDFile()
if os.path.exists(initd_bin):
return 'ok'
return 'fail'
return "Apple Computer does not support"
shell_cmd = 'systemctl status mongod | grep loaded | grep "enabled;"'
@@ -240,17 +194,8 @@ def initdStatus():
def initdInstall():
import shutil
if not app_debug:
if mw.isAppleSystem():
return "Apple Computer does not support"
if mw.isAppleSystem():
source_bin = initDreplace()
initd_bin = getInitDFile()
shutil.copyfile(source_bin, initd_bin)
mw.execShell('chmod +x ' + initd_bin)
mw.execShell('chkconfig --add ' + getPluginName())
return "Apple Computer does not support"
if os.path.exists("/usr/lib/systemd/system/mongodb.service"):
mw.execShell('systemctl enable mongodb')
@@ -260,13 +205,8 @@ def initdInstall():
def initdUinstall():
if not app_debug:
if mw.isAppleSystem():
return "Apple Computer does not support"
if mw.isAppleSystem():
mw.execShell('chkconfig --del ' + getPluginName())
initd_bin = getInitDFile()
os.remove(initd_bin)
return "Apple Computer does not support"
if os.path.exists("/usr/lib/systemd/system/mongodb.service"):
mw.execShell('systemctl disable mongodb')
+3 -3
View File
@@ -4,15 +4,15 @@
"name": "mongodb",
"title": "Mongodb",
"shell": "install.sh",
"versions":["4.4.14","5.0.4"],
"updates":["4.4.14","5.0.4"],
"versions":["4.4","5.0"],
"updates":["4.4","5.0"],
"tip": "soft",
"checks": "server/mongodb",
"path": "server/mongodb",
"display": 1,
"author": "mongodb",
"date": "2021-11-23",
"home": "https://www.mongodb.com/",
"home": "https://www.mongodb.com/docs/v4.4/installation/",
"type": 0,
"pid": "2"
}
+136 -9
View File
@@ -32,52 +32,179 @@ else
OSNAME='unknow'
fi
SYS_VERSION_ID=`cat /etc/*-release | grep VERSION_ID | awk -F = '{print $2}' | awk -F "\"" '{print $2}'`
Install_app_mac()
{
if [ ! -f $serverPath/source/mongodb-macos-x86_64-${VERSION}.tgz ];then
wget -O $serverPath/source/mongodb-macos-x86_64-${VERSION}.tgz https://fastdl.mongodb.org/osx/mongodb-macos-x86_64-${VERSION}.tgz
fi
cd $serverPath/source && tar -zxvf mongodb-macos-x86_64-${VERSION}.tgz
cd mongodb-macos-x86_64-${VERSION} && mv ./* $serverPath/mongodb
}
Install_Linux_Ubuntu()
{
##################### Ubuntu start #####################
if [ "$SYS_VERSION_ID" == "22" ]; then
echo "Not yet supported"
exit 1
fi
if [ -f /lib/systemd/system/mongod.service ];then
echo 'alreay exist!'
exit 0
fi
wget -qO - https://www.mongodb.org/static/pgp/server-${VERSION}.asc | sudo apt-key add -
sudo apt install gnupg
touch /etc/apt/sources.list.d/mongodb-org-${VERSION}.list
lsb_release -dc
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/${VERSION} multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-${VERSION}.list
apt update -y
apt install -y mongodb-org
##################### Ubuntu end #####################
}
Uninstall_Linux_Ubuntu()
{
systemctl stop mongod
apt purge -y mongodb-org*
apt autoremove -y
rm -r /var/log/mongodb
rm -r /var/lib/mongodb
}
Install_Linux_Debian()
{
##################### debian start #####################
if [ "$SYS_VERSION_ID" -ge "11" ]; then
echo "Not yet supported"
exit 1
fi
if [ -f /lib/systemd/system/mongod.service ];then
echo 'alreay exist!'
exit 0
fi
wget -qO - https://www.mongodb.org/static/pgp/server-${VERSION}.asc | sudo apt-key add -
apt install -y gnupg
wget -qO - https://www.mongodb.org/static/pgp/server-${VERSION}.asc | sudo apt-key add -
echo "deb http://repo.mongodb.org/apt/debian buster/mongodb-org/${VERSION} main" | sudo tee /etc/apt/sources.list.d/mongodb-org-${VERSION}.list
apt update -y
apt install -y mongodb-org
echo "mongodb-org hold" | sudo dpkg --set-selections
echo "mongodb-org-server hold" | sudo dpkg --set-selections
echo "mongodb-org-shell hold" | sudo dpkg --set-selections
echo "mongodb-org-mongos hold" | sudo dpkg --set-selections
echo "mongodb-org-tools hold" | sudo dpkg --set-selections
##################### debian end #####################
}
Uninstall_Linux_Debian()
{
systemctl stop mongod
apt purge -y mongodb-org*
apt autoremove -y
rm -r /var/log/mongodb
rm -r /var/lib/mongodb
}
# https://repo.mongodb.org/yum/redhat/7/mongodb-org/5.0/x86_64/RPMS/mongodb-org-server-5.0.4-1.el7.x86_64.rpm
Install_app_linux(){
Install_Linux_CentOS()
{
##################### centos start #####################
if [ ! -f $serverPath/source/mongodb-org-server-${VERSION}-1.el7.x86_64.rpm ];then
wget -O $serverPath/source/mongodb-org-server-${VERSION}-1.el7.x86_64.rpm https://repo.mongodb.org/yum/redhat/7/mongodb-org/5.0/x86_64/RPMS/mongodb-org-server-${VERSION}-1.el7.x86_64.rpm
fi
rpm -ivh $serverPath/source/mongodb-org-server-${VERSION}-1.el7.x86_64.rpm
##################### centos end #####################
}
Install_app_linux()
{
if [ "$OSNAME" == "ubuntu" ];then
Install_Linux_Ubuntu
elif [ "$OSNAME" == "debian" ];then
Install_Linux_Debian
elif [ "$OSNAME" == "centos" ];then
Install_Linux_CentOS
else
echo "Not yet supported"
exit 1
fi
}
Install_app()
{
pip3 install pymongo
echo '正在安装脚本文件...' > $install_tmp
mkdir -p $serverPath/source
mkdir -p $serverPath/mongodb
if [ "macos" == "$OSNAME" ];then
Install_app_mac
elif [ "ubuntu" == "$OSNAME" ] || [ "debian" == "$OSNAME" ] ;then
apt install -y mongodb
else
Install_app_linux
fi
echo "${VERSION}" > $serverPath/mongodb/version.pl
echo '安装完成' > $install_tmp
#初始化
cd ${rootPath} && python3 ${rootPath}/plugins/mongodb/index.py start
cd ${rootPath} && python3 ${rootPath}/plugins/mongodb/index.py initd_install
}
Uninstall_app_linux()
{
##################
if [ "$OSNAME" == "ubuntu" ];then
Uninstall_Linux_Ubuntu
elif [ "$OSNAME" == "debian" ];then
Unstall_Linux_Debian
elif [ "$OSNAME" == "centos" ];then
Install_Linux_CentOS
else
echo "ok"
fi
##################
}
Uninstall_app()
{
# apt remove mongodb -y
if [ "macos" == "$OSNAME" ];then
echo 'mac'
else
Uninstall_app_linux
fi
rm -rf $serverPath/mongodb
echo "Uninstall_mongodb" > $install_tmp
}
+3
View File
@@ -52,7 +52,10 @@
</style>
<script type="text/javascript">
resetPluginWinWidth(800);
var loading = layer.msg("资源加载中...", { icon: 16, time: 0, shade: 0.3 });
$.getScript( "/plugins/file?name=mysql&f=js/mysql.js", function(){
layer.close(loading);
pluginService('mysql',$('.plugin_version').attr('version'));
});
</script>
+2 -2
View File
@@ -572,7 +572,7 @@ def setMyPort():
def runInfo():
if status(version) == 'stop':
return mw.returnJson(false, 'MySQL未启动', [])
return mw.returnJson(False, 'MySQL未启动', [])
db = pMysqlDb()
data = db.query('show global status')
@@ -1470,7 +1470,7 @@ def setDbSlave(version):
def getMasterStatus(version=''):
if status(version) == 'stop':
return mw.returnJson(false, 'MySQL未启动,或正在启动中...!', [])
return mw.returnJson(False, 'MySQL未启动,或正在启动中...!', [])
conf = getConf()
con = mw.readFile(conf)
+1 -1
View File
@@ -36,7 +36,7 @@ fi
sh -x $curPath/versions/$2/install.sh $1
if [ "${action}" == "install" ];then
if [ "${action}" == "install" ] && [ -d $serverPath/mysql ];then
#初始化
cd ${rootPath} && python3 ${rootPath}/plugins/mysql/index.py start ${type}
cd ${rootPath} && python3 ${rootPath}/plugins/mysql/index.py initd_install ${type}
+4 -3
View File
@@ -34,7 +34,7 @@ Install_mysql()
fi
if [ ! -f ${mysqlDir}/mysql-5.5.62.tar.gz ];then
wget -O ${mysqlDir}/mysql-5.5.62.tar.gz https://dev.mysql.com/get/Downloads/MySQL-5.5/mysql-5.5.62.tar.gz
wget -O ${mysqlDir}/mysql-5.5.62.tar.gz --tries=3 https://dev.mysql.com/get/Downloads/MySQL-5.5/mysql-5.5.62.tar.gz
fi
if [ ! -d ${mysqlDir}/mysql-5.5.62 ];then
@@ -57,13 +57,14 @@ Install_mysql()
-DDEFAULT_CHARSET=utf8mb4 \
-DDEFAULT_COLLATION=utf8mb4_general_ci \
-DCMAKE_C_COMPILER=/usr/bin/gcc \
-DCMAKE_CXX_COMPILER=/usr/bin/g++ \
&& make ${MAKEJN:--j2} && make install && make clean
-DCMAKE_CXX_COMPILER=/usr/bin/g++
make clean && make && make install && make clean
if [ -d $serverPath/mysql ];then
echo '5.5' > $serverPath/mysql/version.pl
echo '安装完成' > $install_tmp
else
rm -rf ${mysqlDir}/mysql-5.5.62
echo '安装失败' > $install_tmp
fi
fi
+18 -5
View File
@@ -38,13 +38,23 @@ Install_mysql()
if [ ! -f ${mysqlDir}/mysql-5.6.50.tar.gz ];then
wget -O ${mysqlDir}/mysql-5.6.50.tar.gz https://cdn.mysql.com/Downloads/MySQL-5.6/mysql-5.6.50.tar.gz
wget -O ${mysqlDir}/mysql-5.6.50.tar.gz --tries=3 https://cdn.mysql.com/Downloads/MySQL-5.6/mysql-5.6.50.tar.gz
fi
if [ ! -d ${mysqlDir}/mysql-5.6.50 ];then
cd ${mysqlDir} && tar -zxvf ${mysqlDir}/mysql-5.6.50.tar.gz
fi
OPTIONS=''
##check openssl version
OPENSSL_VERSION=`openssl version|awk '{print $2}'|awk -F '.' '{print $1}'`
if [ "${OPENSSL_VERSION}" -ge "3" ];then
#openssl version to high
cd $serverPath/mdserver-web/plugins/php/lib && /bin/bash openssl.sh
export PKG_CONFIG_PATH=$serverPath/lib/openssl/lib/pkgconfig
OPTIONS="-DWITH_SSL=${serverPath}/lib/openssl"
fi
if [ ! -d $serverPath/mysql ];then
cd ${mysqlDir}/mysql-5.6.50 && cmake \
@@ -59,16 +69,19 @@ Install_mysql()
-DWITH_PARTITION_STORAGE_ENGINE=1 \
-DEXTRA_CHARSETS=all \
-DDEFAULT_CHARSET=utf8mb4 \
-DCMAKE_C_COMPILER=/usr/bin/gcc \
-DCMAKE_CXX_COMPILER=/usr/bin/g++ \
-DDEFAULT_COLLATION=utf8mb4_general_ci \
&& make ${MAKEJN:--j2} && make install && make clean
$OPTIONS \
-DCMAKE_C_COMPILER=/usr/bin/gcc \
-DCMAKE_CXX_COMPILER=/usr/bin/g++
make clean && make && make install && make clean
if [ -d $serverPath/mysql ];then
echo '5.6' > $serverPath/mysql/version.pl
echo '安装完成' > $install_tmp
else
rm -rf ${mysqlDir}/mysql-5.6.50
echo '安装失败' > $install_tmp
fi
fi
+22 -5
View File
@@ -40,7 +40,7 @@ Install_mysql()
if [ ! -f ${mysqlDir}/mysql-boost-${VERSION}.tar.gz ];then
wget -O ${mysqlDir}/mysql-boost-${VERSION}.tar.gz https://cdn.mysql.com/Downloads/MySQL-5.7/mysql-boost-${VERSION}.tar.gz
wget -O ${mysqlDir}/mysql-boost-${VERSION}.tar.gz --tries=3 https://cdn.mysql.com/Downloads/MySQL-5.7/mysql-boost-${VERSION}.tar.gz
fi
#检测文件是否损坏.
@@ -52,7 +52,7 @@ Install_mysql()
else
# 重新下载
rm -rf ${mysqlDir}/mysql-${VERSION}
wget -O ${mysqlDir}/mysql-boost-${VERSION}.tar.gz https://cdn.mysql.com/Downloads/MySQL-5.7/mysql-boost-${VERSION}.tar.gz
wget -O ${mysqlDir}/mysql-boost-${VERSION}.tar.gz --tries=3 https://cdn.mysql.com/Downloads/MySQL-5.7/mysql-boost-${VERSION}.tar.gz
fi
fi
@@ -60,6 +60,16 @@ Install_mysql()
cd ${mysqlDir} && tar -zxvf ${mysqlDir}/mysql-boost-${VERSION}.tar.gz
fi
OPTIONS=''
##check openssl version
OPENSSL_VERSION=`openssl version|awk '{print $2}'|awk -F '.' '{print $1}'`
if [ "${OPENSSL_VERSION}" -ge "3" ];then
#openssl version to high
cd $serverPath/mdserver-web/plugins/php/lib && /bin/bash openssl.sh
export PKG_CONFIG_PATH=$serverPath/lib/openssl/lib/pkgconfig
OPTIONS="-DWITH_SSL=${serverPath}/lib/openssl"
fi
if [ ! -d $serverPath/mysql ];then
cd ${mysqlDir}/mysql-${VERSION} && cmake \
-DCMAKE_INSTALL_PREFIX=$serverPath/mysql \
@@ -75,12 +85,19 @@ Install_mysql()
-DDEFAULT_CHARSET=utf8mb4 \
-DDEFAULT_COLLATION=utf8mb4_general_ci \
-DDOWNLOAD_BOOST=1 \
$OPTIONS \
-DCMAKE_C_COMPILER=/usr/bin/gcc \
-DCMAKE_CXX_COMPILER=/usr/bin/g++ \
-DWITH_BOOST=${mysqlDir}/mysql-${VERSION}/boost/
make ${MAKEJN:--j2} && make install && make clean
echo '5.7' > $serverPath/mysql/version.pl
echo '安装完成' > $install_tmp
make clean && make && make install && make clean
if [ -d $serverPath/mysql ];then
echo '5.7' > $serverPath/mysql/version.pl
echo '安装完成' > $install_tmp
else
rm -rf ${mysqlDir}/mysql-${VERSION}
echo '安装失败' > $install_tmp
fi
fi
}
+15 -2
View File
@@ -59,6 +59,15 @@ Install_mysql()
cd ${mysqlDir} && tar -zxvf ${mysqlDir}/mysql-boost-8.0.25.tar.gz
fi
OPTIONS=''
##check openssl version
OPENSSL_VERSION=`openssl version|awk '{print $2}'|awk -F '.' '{print $1}'`
if [ "${OPENSSL_VERSION}" -ge "3" ];then
#openssl version to high
cd $serverPath/mdserver-web/plugins/php/lib && /bin/bash openssl.sh
export PKG_CONFIG_PATH=$serverPath/lib/openssl/lib/pkgconfig
OPTIONS="-DWITH_SSL=${serverPath}/lib/openssl"
fi
if [ ! -d $serverPath/mysql ];then
cd ${mysqlDir}/mysql-8.0.25 && ${INSTALL_CMD} \
@@ -76,15 +85,19 @@ Install_mysql()
-DDEFAULT_COLLATION=utf8mb4_general_ci \
-DDOWNLOAD_BOOST=1 \
-DFORCE_INSOURCE_BUILD=1 \
$OPTIONS \
-DCMAKE_C_COMPILER=/usr/bin/gcc \
-DCMAKE_CXX_COMPILER=/usr/bin/g++ \
-DWITH_BOOST=${mysqlDir}/mysql-8.0.25/boost/
make ${MAKEJN:--j2} && make install && make clean
make clean && make && make install && make clean
if [ -d $serverPath/mysql ];then
echo '8.0' > $serverPath/mysql/version.pl
echo '安装完成' > $install_tmp
else
rm -rf ${mysqlDir}/mysql-8.0.25
echo '安装失败' > $install_tmp
fi
echo '安装完成' > $install_tmp
fi
}
+2 -2
View File
@@ -11,6 +11,6 @@
"home":"http://openresty.org",
"date":"2017-11-24",
"pid": "1",
"versions": ["1.11.2.5", "1.13.6.2","1.15.8.3","1.19.3.1","1.21.4.1"],
"updates": ["1.11.2.5", "1.13.6.2","1.15.8.3","1.19.3.1","1.21.4.1"]
"versions": ["1.15.8.3","1.17.8.2","1.19.3.1","1.21.4.1"],
"updates": ["1.15.8.3","1.17.8.2","1.19.3.1","1.21.4.1"]
}
+2
View File
@@ -49,6 +49,8 @@ Install_openresty()
if [ -d $serverPath/openresty ];then
echo "${VERSION}" > $serverPath/openresty/version.pl
mkdir -p $serverPath/web_conf/php/conf
echo "" > $serverPath/web_conf/php/conf/enable-php-00.conf
#初始化
+27 -117
View File
@@ -3,7 +3,17 @@ export PATH=$PATH:/opt/local/bin:/opt/local/sbin:/opt/local/share/man:/usr/local
DIR=$(cd "$(dirname "$0")"; pwd)
PHP_VER=53
# cd /www/server/mdserver-web/scripts/quick && bash debug.sh
# cd /www/server/mdserver-web/plugins/php && bash all_test.sh
# cd /www/server/mdserver-web/plugins/php/versions/52/ && bash gd.sh install 52
# cd /www/server/mdserver-web/plugins/php/versions/52/ && bash openssl.sh install 52
# cd /www/server/mdserver-web/plugins/php/versions/81/ && bash imagemagick.sh install 81
# cd /www/server/mdserver-web/plugins/php/versions/70/ && bash imagemagick.sh install 70
PHP_VER=52
echo "php${PHP_VER} -- start"
cmd_ext=$(ls -l $DIR/versions/$PHP_VER/ |awk '{print $9}')
cd $DIR && /bin/bash install.sh install $PHP_VER
@@ -18,124 +28,24 @@ done
echo "php${PHP_VER} -- end"
PHP_VER=54
echo "php${PHP_VER} -- start"
cmd_ext=$(ls -l $DIR/versions/$PHP_VER/ |awk '{print $9}')
cd $DIR && /bin/bash install.sh install $PHP_VER
for ii in $cmd_ext
do
if [ "install.sh" == "$ii" ];then
echo '' > /tmp/t.log
else
cd $DIR/versions/$PHP_VER && /bin/bash $ii install $PHP_VER
fi
done
echo "php${PHP_VER} -- end"
PHP_VER=55
echo "php${PHP_VER} -- start"
cmd_ext=$(ls -l $DIR/versions/$PHP_VER/ |awk '{print $9}')
cd $DIR && /bin/bash install.sh install $PHP_VER
for ii in $cmd_ext
do
if [ "install.sh" == "$ii" ];then
echo '' > /tmp/t.log
else
cd $DIR/versions/$PHP_VER && /bin/bash $ii install $PHP_VER
fi
done
echo "php${PHP_VER} -- end"
PHP_VER=56
echo "php${PHP_VER} -- start"
cmd_ext=$(ls -l $DIR/versions/$PHP_VER/ |awk '{print $9}')
cd $DIR && /bin/bash install.sh install $PHP_VER
for ii in $cmd_ext
do
if [ "install.sh" == "$ii" ];then
echo '' > /tmp/t.log
else
cd $DIR/versions/$PHP_VER && /bin/bash $ii install $PHP_VER
fi
done
echo "php${PHP_VER} -- end"
PHP_VER=70
echo "php${PHP_VER} -- start"
cmd_ext=$(ls -l $DIR/versions/$PHP_VER/ |awk '{print $9}')
cd $DIR && /bin/bash install.sh install $PHP_VER
for ii in $cmd_ext
do
if [ "install.sh" == "$ii" ];then
echo '' > /tmp/t.log
else
cd $DIR/versions/$PHP_VER && /bin/bash $ii install $PHP_VER
fi
done
echo "php${PHP_VER} -- end"
PHP_VER=71
echo "php${PHP_VER} -- start"
cmd_ext=$(ls -l $DIR/versions/$PHP_VER/ |awk '{print $9}')
cd $DIR && /bin/bash install.sh install $PHP_VER
for ii in $cmd_ext
do
if [ "install.sh" == "$ii" ];then
echo '' > /tmp/t.log
else
cd $DIR/versions/$PHP_VER && /bin/bash $ii install $PHP_VER
fi
done
echo "php${PHP_VER} -- end"
PHP_VER=72
echo "php${PHP_VER} -- start"
cmd_ext=$(ls -l $DIR/versions/$PHP_VER/ |awk '{print $9}')
cd $DIR && /bin/bash install.sh install $PHP_VER
for ii in $cmd_ext
do
if [ "install.sh" == "$ii" ];then
echo '' > /tmp/t.log
else
cd $DIR/versions/$PHP_VER && /bin/bash $ii install $PHP_VER
fi
done
echo "php${PHP_VER} -- end"
PHP_VER=73
echo "php${PHP_VER} -- start"
cmd_ext=$(ls -l $DIR/versions/$PHP_VER/ |awk '{print $9}')
cd $DIR && /bin/bash install.sh install $PHP_VER
for ii in $cmd_ext
do
if [ "install.sh" == "$ii" ];then
echo '' > /tmp/t.log
else
cd $DIR/versions/$PHP_VER && /bin/bash $ii install $PHP_VER
PHP_VER_LIST=(53 54 55 56 70 71 72 73 74 80 81)
# PHP_VER_LIST=(81)
for PHP_VER in ${PHP_VER_LIST[@]}; do
echo "php${PHP_VER} -- start"
if [ -d /www/server/php/${PHP_VER} ];then
cmd_ext=$(ls -l $DIR/versions/$PHP_VER/ |awk '{print $9}')
for ii in $cmd_ext
do
echo "${ii}"
if [ "install.sh" == "$ii" ];then
echo '' > /tmp/t.log
else
cd $DIR/versions/$PHP_VER/ && bash $ii install ${PHP_VER}
fi
done
fi
echo "php${PHP_VER} -- end"
done
echo "php${PHP_VER} -- end"
PHP_VER=74
echo "php${PHP_VER} -- start"
cmd_ext=$(ls -l $DIR/versions/$PHP_VER/ |awk '{print $9}')
cd $DIR && /bin/bash install.sh install $PHP_VER
for ii in $cmd_ext
do
if [ "install.sh" == "$ii" ];then
echo '' > /tmp/t.log
else
cd $DIR/versions/$PHP_VER && /bin/bash $ii install $PHP_VER
fi
done
echo "php${PHP_VER} -- end"
rm -rf /tmp/t.log
+1
View File
@@ -1,3 +1,4 @@
set $PHP_ENV 1;
location ~ [^/]\.php(/|$)
{
try_files $uri =404;
+3 -3
View File
@@ -6,10 +6,10 @@
<section name="global_options">
Pid file
<value name="pid_file">/www/server/php/52/logs/php-fpm.pid</value>
<value name="pid_file">/www/server/php/52/var/run/php-fpm.pid</value>
Error log file
<value name="error_log">/www/server/php/52/logs/php-fpm.log</value>
<value name="error_log">/www/server/php/52/var/log/php-fpm.log</value>
Log level
<value name="log_level">notice</value>
@@ -107,7 +107,7 @@
<value name="request_slowlog_timeout">0s</value>
The log file for slow requests
<value name="slowlog">logs/slow.log</value>
<value name="slowlog">var/log/www-slow.log</value>
Set open file desc rlimit
<value name="rlimit_files">1024</value>
+1 -1
View File
@@ -1,4 +1,4 @@
location /{$PHP_VERSION} {
root {$ROOT_PATH}/phpinfo;
include enable-php-{$PHP_VERSION}.conf;
include {$SERVER_PATH}/web_conf/php/conf/enable-php-{$PHP_VERSION}.conf;
}
+34 -21
View File
@@ -274,7 +274,7 @@ def phpOp(version, method):
data = mw.execShell('systemctl ' + method + ' php' + version)
if data[1] == '':
return 'ok'
return 'fail'
return data[1]
data = mw.execShell(file + ' ' + method)
if data[1] == '':
@@ -287,7 +287,14 @@ def start(version):
def stop(version):
return phpOp(version, 'stop')
status = phpOp(version, 'stop')
if version == '52':
file = initReplace(version)
data = mw.execShell(file + ' ' + 'stop')
if data[1] == '':
return 'ok'
return status
def restart(version):
@@ -445,21 +452,23 @@ def setMaxTime(version):
def setMaxSize(version):
args = getArgs()
if not 'max' in args:
return 'missing time args!'
max = args['max']
if int(max) < 2:
data = checkArgs(args, ['max'])
if not data[0]:
return data[1]
maxVal = args['max']
if int(maxVal) < 2:
return mw.returnJson(False, '上传大小限制不能小于2MB!')
path = getServerDir() + '/' + version + '/etc/php.ini'
conf = mw.readFile(path)
rep = u"\nupload_max_filesize\s*=\s*[0-9]+M"
conf = re.sub(rep, u'\nupload_max_filesize = ' + max + 'M', conf)
conf = re.sub(rep, u'\nupload_max_filesize = ' + maxVal + 'M', conf)
rep = u"\npost_max_size\s*=\s*[0-9]+M"
conf = re.sub(rep, u'\npost_max_size = ' + max + 'M', conf)
conf = re.sub(rep, u'\npost_max_size = ' + maxVal + 'M', conf)
mw.writeFile(path, conf)
msg = mw.getInfo('设置PHP-{1}最大上传大小为[{2}MB]!', (version, max,))
msg = mw.getInfo('设置PHP-{1}最大上传大小为[{2}MB]!', (version, maxVal,))
mw.writeLog('插件管理[PHP]', msg)
return mw.returnJson(True, '设置成功!')
@@ -555,13 +564,13 @@ def getFpmStatus(version):
try:
url = 'http://' + mw.getHostAddr() + '/phpfpm_status_' + version + '?json'
result = mw.httpGet(url)
result = mw.httpGet(url, 1)
data = json.loads(result)
fTime = time.localtime(int(data['start time']))
data['start time'] = time.strftime('%Y-%m-%d %H:%M:%S', fTime)
except Exception as e:
url = 'http://127.0.0.1/phpfpm_status_' + version + '?json'
result = mw.httpGet(url)
result = mw.httpGet(url, 1)
data = json.loads(result)
fTime = time.localtime(int(data['start time']))
data['start time'] = time.strftime('%Y-%m-%d %H:%M:%S', fTime)
@@ -605,20 +614,20 @@ def setDisableFunc(version):
def checkPhpinfoFile(v):
if mw.isInstalledWeb():
sdir = mw.getServerDir()
dfile = sdir + '/openresty/nginx/conf/php_status/phpinfo_' + v + '.conf'
if not os.path.exists(dfile):
tpl = getPluginDir() + '/conf/phpinfo.conf'
content = mw.readFile(tpl)
content = contentReplace(content, v)
mw.writeFile(dfile, content)
mw.restartWeb()
sdir = mw.getServerDir()
dfile = sdir + '/web_conf/php/status/phpinfo_' + v + '.conf'
if not os.path.exists(dfile):
tpl = getPluginDir() + '/conf/phpinfo.conf'
content = mw.readFile(tpl)
content = contentReplace(content, v)
mw.writeFile(dfile, content)
mw.restartWeb()
def getPhpinfo(v):
checkPhpinfoFile(v)
sPath = mw.getRootDir() + '/phpinfo/' + v
mw.execShell("rm -rf " + mw.getRootDir() + '/phpinfo')
mw.execShell("mkdir -p " + sPath)
mw.writeFile(sPath + '/phpinfo.php', '<?php phpinfo(); ?>')
@@ -629,6 +638,8 @@ def getPhpinfo(v):
def get_php_info(args):
if not mw.isInstalledWeb():
return "openresty is not running!!!"
return getPhpinfo(args['version'])
@@ -675,9 +686,11 @@ def installLib(version):
name + '.sh' + ' install ' + version
rettime = time.strftime('%Y-%m-%d %H:%M:%S')
insert_info = (None, '安装[' + name + '-' + version + ']',
insert_info = (None, '安装[' + name + '-PHP' + version + ']',
'execshell', '0', rettime, execstr)
mw.M('tasks').add('id,name,type,status,addtime,execstr', insert_info)
mw.triggerTask()
return mw.returnJson(True, '已将下载任务添加到队列!')
+1 -1
View File
@@ -2,7 +2,7 @@
php_fpm_BIN=/www/server/php/52/bin/php-cgi
php_fpm_CONF=/www/server/php/52/etc/php-fpm.conf
php_fpm_PID=/www/server/php/52/logs/php-fpm.pid
php_fpm_PID=/www/server/php/52/var/run/php-fpm.pid
php_opts="--fpm-config $php_fpm_CONF"
+1 -1
View File
@@ -43,7 +43,7 @@ fi
cd ${curPath} && sh -x $curPath/versions/$2/install.sh $1
if [ "${action}" == "install" ];then
if [ "${action}" == "install" ] && [ -d ${serverPath}/php/${type} ];then
#初始化
cd ${rootPath} && python3 ${rootPath}/plugins/php/index.py start ${type}
cd ${rootPath} && python3 ${rootPath}/plugins/php/index.py initd_install ${type}
+28
View File
@@ -0,0 +1,28 @@
#!/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")
# echo $rootPath
# cd /www/server/mdserver-web/plugins/php/lib && /bin/bash libmemcached.sh
SERVER_ROOT=$rootPath/lib
SOURCE_ROOT=$rootPath/source/lib
#----------------------------- libmemcached start -------------------------#
if [ ! -d ${SERVER_ROOT}/libmemcached ];then
cd ${SOURCE_ROOT}
if [ ! -f ${SOURCE_ROOT}/libmemcached-1.0.4.tar.gz ];then
wget -O libmemcached-1.0.4.tar.gz https://launchpad.net/libmemcached/1.0/1.0.4/+download/libmemcached-1.0.4.tar.gz -T 20
fi
tar -zxf libmemcached-1.0.4.tar.gz
cd libmemcached-1.0.4
./configure --prefix=${SERVER_ROOT}/libmemcached -with-memcached && make && make install
fi
#----------------------------- libmemcached end -------------------------#
+38
View File
@@ -0,0 +1,38 @@
#!/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")
# echo $rootPath
SERVER_ROOT=$rootPath/lib
SOURCE_ROOT=$rootPath/source/lib
# if [ ! -d ${SERVER_ROOT}/openssl ];then
# cd ${SOURCE_ROOT}
# if [ ! -f ${SOURCE_ROOT}/openssl-1.0.2q.tar.gz ];then
# wget https://github.com/midoks/mdserver-web/releases/download/init/openssl-1.0.2q.tar.gz -T 20
# fi
# tar -zxf openssl-1.0.2q.tar.gz
# cd openssl-1.0.2q
# ./config --openssldir=${SERVER_ROOT}/openssl zlib-dynamic shared
# make && make install
# fi
if [ ! -d ${SERVER_ROOT}/openssl ];then
cd ${SOURCE_ROOT}
if [ ! -f ${SOURCE_ROOT}/openssl-1.1.1p.tar.gz ];then
wget -O ${SOURCE_ROOT}/openssl-1.1.1p.tar.gz https://www.openssl.org/source/openssl-1.1.1p.tar.gz
fi
tar -zxvf openssl-1.1.1p.tar.gz
cd openssl-1.1.1p
./config --prefix=${SERVER_ROOT}/openssl zlib-dynamic shared
make && make install
fi
+27
View File
@@ -0,0 +1,27 @@
#!/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")
# echo $rootPath
SERVER_ROOT=$rootPath/lib
SOURCE_ROOT=$rootPath/source/lib
if [ ! -d ${SERVER_ROOT}/openssl10 ];then
cd ${SOURCE_ROOT}
if [ ! -f ${SOURCE_ROOT}/openssl-1.0.2q.tar.gz ];then
wget https://github.com/midoks/mdserver-web/releases/download/init/openssl-1.0.2q.tar.gz -T 20
fi
tar -zxf openssl-1.0.2q.tar.gz
cd openssl-1.0.2q
./config --openssldir=${SERVER_ROOT}/openssl10 zlib-dynamic shared
make && make install
fi
+4 -2
View File
@@ -77,7 +77,8 @@ Install_lib()
echo "${LIBNAME}.allowed_admin_path=/www/wwwroot/you_project_dir" >> $serverPath/php/$version/etc/php.ini
$serverPath/php/init.d/php$version reload
bash ${rootPath}/plugins/php/versions/lib.sh $version restart
echo '==========================================================='
echo 'successful!'
}
@@ -100,7 +101,8 @@ Uninstall_lib()
sed -i $BAK "/${LIBNAME}/d" $serverPath/php/$version/etc/php.ini
rm -f $extFile
$serverPath/php/init.d/php$version reload
bash ${rootPath}/plugins/php/versions/lib.sh $version restart
echo '==============================================='
echo 'successful!'
}
+3 -2
View File
@@ -68,7 +68,7 @@ Install_lib()
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
bash ${rootPath}/plugins/php/versions/lib.sh $version restart
echo '==========================================================='
echo 'successful!'
}
@@ -91,7 +91,8 @@ Uninstall_lib()
sed -i $BAK "/${LIBNAME}/d" $serverPath/php/$version/etc/php.ini
rm -f $extFile
$serverPath/php/init.d/php$version reload
bash ${rootPath}/plugins/php/versions/lib.sh $version restart
echo '==============================================='
echo 'successful!'
}
+30 -7
View File
@@ -27,6 +27,26 @@ else
BAK=''
fi
sysName=`uname`
echo "use system: ${sysName}"
if [ ${sysName} == "Darwin" ]; then
OSNAME='macos'
elif grep -Eqi "CentOS" /etc/issue || grep -Eq "CentOS" /etc/*-release; then
OSNAME='centos'
elif grep -Eqi "Fedora" /etc/issue || grep -Eq "Fedora" /etc/*-release; then
OSNAME='fedora'
elif grep -Eqi "Debian" /etc/issue || grep -Eq "Debian" /etc/*-release; then
OSNAME='debian'
elif grep -Eqi "Ubuntu" /etc/issue || grep -Eq "Ubuntu" /etc/*-release; then
OSNAME='ubuntu'
elif grep -Eqi "Raspbian" /etc/issue || grep -Eq "Raspbian" /etc/*-release; then
OSNAME='raspbian'
else
OSNAME='unknow'
fi
Install_lib()
{
@@ -36,9 +56,12 @@ Install_lib()
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 [ "$OSNAME" == "debian" ] && [ "$OSNAME" == "ubuntu" ];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/
fi
if [ ! -f "$extFile" ];then
@@ -54,8 +77,7 @@ Install_lib()
--with-gd \
--with-jpeg-dir=/usr/lib \
--with-freetype-dir=${serverPath}/lib/freetype_old \
--enable-gd-native-ttf \
--enable-gd-jis-conv
--enable-gd-native-ttf
make clean && make && make install && make clean
@@ -70,7 +92,7 @@ Install_lib()
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
bash ${rootPath}/plugins/php/versions/lib.sh $version restart
echo '==========================================================='
echo 'successful!'
}
@@ -93,7 +115,8 @@ Uninstall_lib()
sed -i $BAK "/${LIBNAME}/d" $serverPath/php/$version/etc/php.ini
rm -f $extFile
$serverPath/php/init.d/php$version reload
bash ${rootPath}/plugins/php/versions/lib.sh $version restart
echo '==============================================='
echo 'successful!'
}
+7
View File
@@ -161,6 +161,13 @@ if [ ! -d $serverPath/php/${PHP_VER}/lib/php/extensions/no-debug-non-zts-2006061
mkdir -p $serverPath/php/${PHP_VER}/lib/php/extensions/no-debug-non-zts-20060613
fi
# ps -ef|grep php/52 |grep -v grep |awk '{print $2}'|xargs kill
# /www/server/php/init.d/php52 start
# /www/server/php/52/sbin/php-fpm start
# cd /www/server/mdserver-web && python3 /www/server/mdserver-web/plugins/php/index.py start 52
mkdir -p $serverPath/php/${PHP_VER}/var/log
mkdir -p $serverPath/php/${PHP_VER}/var/run
#------------------------ install end ------------------------------------#
}
+9 -6
View File
@@ -35,19 +35,21 @@ Install_lib()
return
fi
cd $serverPath/mdserver-web/plugins/php/lib && /bin/bash icu.sh
if [ ! -f "$extFile" ];then
php_lib=$sourcePath/php_lib
mkdir -p $php_lib
wget -O $php_lib/${LIBNAME}-${LIBV}.tgz http://pecl.php.net/get/${LIBNAME}-${LIBV}.tgz
cd $php_lib && tar xvf ${LIBNAME}-${LIBV}.tgz
cd ${LIBNAME}-${LIBV}
$serverPath/php/$version/bin/phpize
./configure --with-php-config=$serverPath/php/$version/bin/php-config
make && make install && make clean
./configure --with-php-config=$serverPath/php/$version/bin/php-config \
--with-icu-dir=${serverPath}/lib/icu
make clean && make && make install && make clean
fi
@@ -60,7 +62,7 @@ Install_lib()
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
bash ${rootPath}/plugins/php/versions/lib.sh $version restart
echo '==========================================================='
echo 'successful!'
}
@@ -83,7 +85,8 @@ Uninstall_lib()
sed -i $BAK "/${LIBNAME}/d" $serverPath/php/$version/etc/php.ini
rm -f $extFile
$serverPath/php/init.d/php$version reload
bash ${rootPath}/plugins/php/versions/lib.sh $version restart
echo '==============================================='
echo 'successful!'
}
+97
View File
@@ -0,0 +1,97 @@
#!/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
LIBNAME=ioncube
LIBV=0
sysName=`uname`
actionType=$1
version=$2
IC_VERSION=${version:0:1}.${version:1:2}
NON_ZTS_FILENAME=`ls $serverPath/php/${version}/lib/php/extensions | grep no-debug-non-zts`
extDir=$serverPath/php/${version}/lib/php/extensions/${NON_ZTS_FILENAME}
extFile=${extDir}/${LIBNAME}.so
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
if [ ! -f "$extFile" ];then
php_lib=$sourcePath/php_lib
mkdir -p $php_lib
if [ ! -f $php_lib/ioncube_loaders_lin.tar.gz ];then
wget -O $php_lib/ioncube_loaders_lin.tar.gz https://downloads.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.tar.gz
cd $php_lib && tar -zxvf ioncube_loaders_lin.tar.gz
fi
cd $php_lib/ioncube
cp -rf $php_lib/ioncube/ioncube_loader_lin_${IC_VERSION}.so $extFile
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 "zend_extension=${LIBNAME}.so" >> $serverPath/php/$version/etc/php.ini
bash ${rootPath}/plugins/php/versions/lib.sh $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},请选择其它版本!"
echo "php-$vphp not install ${LIBNAME}, Plese select other version!"
return
fi
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
bash ${rootPath}/plugins/php/versions/lib.sh $version restart
echo '==============================================='
echo 'successful!'
}
if [ "$actionType" == 'install' ];then
Install_lib
elif [ "$actionType" == 'uninstall' ];then
Uninstall_lib
fi
+2 -2
View File
@@ -58,7 +58,7 @@ Install_lib()
echo "extension=${LIBNAME}.so" >> $serverPath/php/$version/etc/php.ini
$serverPath/php/init.d/php$version reload
bash ${rootPath}/plugins/php/versions/lib.sh $version restart
echo '==========================================================='
echo 'successful!'
}
@@ -81,7 +81,7 @@ Uninstall_lib()
sed -i $BAK "/${LIBNAME}/d" $serverPath/php/$version/etc/php.ini
rm -f $extFile
$serverPath/php/init.d/php$version reload
bash ${rootPath}/plugins/php/versions/lib.sh $version restart
echo '==============================================='
echo 'successful!'
}
+105
View File
@@ -0,0 +1,105 @@
#!/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=openssl
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
cd $serverPath/mdserver-web/plugins/php/lib && /bin/bash openssl_10.sh
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}
if [ ! -f "config.m4" ];then
mv config0.m4 config.m4
fi
export PKG_CONFIG_PATH=$serverPath/lib/openssl10/lib/pkgconfig
$serverPath/php/$version/bin/phpize
./configure --with-php-config=$serverPath/php/$version/bin/php-config \
--with-openssl
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
bash ${rootPath}/plugins/php/versions/lib.sh $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
bash ${rootPath}/plugins/php/versions/lib.sh $version restart
echo '==============================================='
echo 'successful!'
}
if [ "$actionType" == 'install' ];then
Install_lib
elif [ "$actionType" == 'uninstall' ];then
Uninstall_lib
fi
+3 -2
View File
@@ -59,7 +59,7 @@ Install_lib()
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
bash ${rootPath}/plugins/php/versions/lib.sh $version restart
echo '==========================================================='
echo 'successful!'
}
@@ -82,7 +82,8 @@ Uninstall_lib()
sed -i $BAK "/${LIBNAME}/d" $serverPath/php/$version/etc/php.ini
rm -f $extFile
$serverPath/php/init.d/php$version reload
bash ${rootPath}/plugins/php/versions/lib.sh $version restart
echo '==============================================='
echo 'successful!'
}
+3 -2
View File
@@ -61,7 +61,7 @@ Install_lib()
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
bash ${rootPath}/plugins/php/versions/lib.sh $version restart
echo '==========================================================='
echo 'successful!'
}
@@ -85,7 +85,8 @@ Uninstall_lib()
sed -i $BAK "/${LIBNAME}/d" $serverPath/php/$version/etc/php.ini
rm -f $extFile
$serverPath/php/init.d/php$version reload
bash ${rootPath}/plugins/php/versions/lib.sh $version restart
echo '==============================================='
echo 'successful!'
}
+2 -2
View File
@@ -66,7 +66,7 @@ Install_lib()
echo "${LIBNAME}.output_dir=/tmp/xhprof" >> $serverPath/php/$version/etc/php.ini
$serverPath/php/init.d/php$version reload
bash ${rootPath}/plugins/php/versions/lib.sh $version restart
echo '==========================================================='
echo 'successful!'
}
@@ -90,7 +90,7 @@ Uninstall_lib()
rm -f $extFile
$serverPath/php/init.d/php$version reload
bash ${rootPath}/plugins/php/versions/lib.sh $version restart
echo '==============================================='
echo 'successful!'
}
+2 -2
View File
@@ -67,7 +67,7 @@ Install_lib()
echo "zend_loader.obfuscation_level_support=3" >> $serverPath/php/$version/etc/php.ini
echo "zend_loader.license_path=" >> $serverPath/php/$version/etc/php.ini
$serverPath/php/init.d/php$version reload
bash ${rootPath}/plugins/php/versions/lib.sh $version restart
echo '==========================================================='
echo 'successful!'
}
@@ -90,7 +90,7 @@ Uninstall_lib()
sed -i $BAK "/\[Zend ZendGuard Loader\]/d" $serverPath/php/$version/etc/php.ini
rm -f $extFile
$serverPath/php/init.d/php$version reload
bash ${rootPath}/plugins/php/versions/lib.sh $version restart
echo '==============================================='
echo 'successful!'
}
+2 -2
View File
@@ -61,7 +61,7 @@ Install_lib()
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
bash ${rootPath}/plugins/php/versions/lib.sh $version restart
echo '==========================================================='
echo 'successful!'
}
@@ -85,7 +85,7 @@ Uninstall_lib()
sed -i $BAK "/${LIBNAME}/d" $serverPath/php/$version/etc/php.ini
rm -f $extFile
$serverPath/php/init.d/php$version reload
bash ${rootPath}/plugins/php/versions/lib.sh $version restart
echo '==============================================='
echo 'successful!'
}
+2 -2
View File
@@ -67,7 +67,7 @@ Install_lib()
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
bash ${rootPath}/plugins/php/versions/lib.sh $version restart
echo '==========================================================='
echo 'successful!'
}
@@ -90,7 +90,7 @@ Uninstall_lib()
sed -i $BAK "/${LIBNAME}/d" $serverPath/php/$version/etc/php.ini
rm -f $extFile
$serverPath/php/init.d/php$version reload
bash ${rootPath}/plugins/php/versions/lib.sh $version restart
echo '==============================================='
echo 'successful!'
}
+105
View File
@@ -0,0 +1,105 @@
#!/bin/bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH
curPath=`pwd`
appPath=$(dirname "$curPath")
rootPath=$(dirname "$curPath")
rootPath=$(dirname "$rootPath")
rootPath=$(dirname "$rootPath")
rootPath=$(dirname "$rootPath")
serverPath=$(dirname "$rootPath")
sourcePath=${serverPath}/source/php
actionType=$1
version=$2
LIBNAME=exif
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
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
FIND_C99=`cat Makefile|grep c99`
if [ "$FIND_C99" == "" ];then
sed -i $BAK 's/CFLAGS \=/CFLAGS \= -std=c99/g' Makefile
fi
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
bash ${rootPath}/plugins/php/versions/lib.sh $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
bash ${rootPath}/plugins/php/versions/lib.sh $version restart
echo '==============================================='
echo 'successful!'
}
if [ "$actionType" == 'install' ];then
Install_lib
elif [ "$actionType" == 'uninstall' ];then
Uninstall_lib
fi
+4 -2
View File
@@ -66,7 +66,7 @@ Install_lib()
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
bash ${rootPath}/plugins/php/versions/lib.sh $version restart
echo '==========================================================='
echo 'successful!'
}
@@ -89,7 +89,9 @@ Uninstall_lib()
sed -i $BAK "/${LIBNAME}/d" $serverPath/php/$version/etc/php.ini
rm -f $extFile
$serverPath/php/init.d/php$version reload
bash ${rootPath}/plugins/php/versions/lib.sh $version restart
echo '==============================================='
echo 'successful!'
}
+2 -2
View File
@@ -53,7 +53,7 @@ else
fi
if [ ! -d $serverPath/php/53 ];then
if [ ! -d $serverPath/php/53/bin ];then
cd $sourcePath/php/php${PHP_VER} && ./configure \
--prefix=$serverPath/php/53 \
--exec-prefix=$serverPath/php/53 \
@@ -99,7 +99,7 @@ if [ -f $serverPath/php/53/sbin/php-fpm.dSYM ];then
fi
if [ ! -d $serverPath/php/53/lib/php/extensions/no-debug-non-zts-20090626 ]; then
if [ -d $serverPath/php/53 ] && [ ! -d $serverPath/php/53/lib/php/extensions/no-debug-non-zts-20090626 ]; then
mkdir -p $serverPath/php/53/lib/php/extensions/no-debug-non-zts-20090626
fi
+2 -2
View File
@@ -63,7 +63,7 @@ Install_lib()
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
bash ${rootPath}/plugins/php/versions/lib.sh $version restart
echo '==========================================================='
echo 'successful!'
}
@@ -86,7 +86,7 @@ Uninstall_lib()
sed -i $BAK "/${LIBNAME}/d" $serverPath/php/$version/etc/php.ini
rm -f $extFile
$serverPath/php/init.d/php$version reload
bash ${rootPath}/plugins/php/versions/lib.sh $version restart
echo '==============================================='
echo 'successful!'
}
+96
View File
@@ -0,0 +1,96 @@
#!/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
LIBNAME=ioncube
LIBV=0
sysName=`uname`
actionType=$1
version=$2
IC_VERSION=${version:0:1}.${version:1:2}
NON_ZTS_FILENAME=`ls $serverPath/php/${version}/lib/php/extensions | grep no-debug-non-zts`
extDir=$serverPath/php/${version}/lib/php/extensions/${NON_ZTS_FILENAME}
extFile=${extDir}/${LIBNAME}.so
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
if [ ! -f "$extFile" ];then
php_lib=$sourcePath/php_lib
mkdir -p $php_lib
if [ ! -f $php_lib/ioncube_loaders_lin.tar.gz ];then
wget -O $php_lib/ioncube_loaders_lin.tar.gz https://downloads.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.tar.gz
cd $php_lib && tar -zxvf ioncube_loaders_lin.tar.gz
fi
cd $php_lib/ioncube
cp -rf $php_lib/ioncube/ioncube_loader_lin_${IC_VERSION}.so $extFile
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 "zend_extension=${LIBNAME}.so" >> $serverPath/php/$version/etc/php.ini
bash ${rootPath}/plugins/php/versions/lib.sh $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},请选择其它版本!"
echo "php-$vphp not install ${LIBNAME}, Plese select other version!"
return
fi
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
bash ${rootPath}/plugins/php/versions/lib.sh $version restart
echo '==============================================='
echo 'successful!'
}
if [ "$actionType" == 'install' ];then
Install_lib
elif [ "$actionType" == 'uninstall' ];then
Uninstall_lib
fi
+2 -2
View File
@@ -57,7 +57,7 @@ Install_lib()
echo "extension=${LIBNAME}.so" >> $serverPath/php/$version/etc/php.ini
$serverPath/php/init.d/php$version reload
bash ${rootPath}/plugins/php/versions/lib.sh $version restart
echo '==========================================================='
echo 'successful!'
}
@@ -80,7 +80,7 @@ Uninstall_lib()
sed -i $BAK "/${LIBNAME}/d" $serverPath/php/$version/etc/php.ini
rm -f $extFile
$serverPath/php/init.d/php$version reload
bash ${rootPath}/plugins/php/versions/lib.sh $version restart
echo '==============================================='
echo 'successful!'
}
+2 -2
View File
@@ -61,7 +61,7 @@ Install_lib()
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
bash ${rootPath}/plugins/php/versions/lib.sh $version restart
echo '==========================================================='
echo 'successful!'
}
@@ -84,7 +84,7 @@ Uninstall_lib()
sed -i $BAK "/${LIBNAME}/d" $serverPath/php/$version/etc/php.ini
rm -f $extFile
$serverPath/php/init.d/php$version reload
bash ${rootPath}/plugins/php/versions/lib.sh $version restart
echo '==============================================='
echo 'successful!'
}
+3 -2
View File
@@ -68,7 +68,7 @@ Install_lib()
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
bash ${rootPath}/plugins/php/versions/lib.sh $version restart
echo '==========================================================='
echo 'successful!'
}
@@ -91,7 +91,8 @@ Uninstall_lib()
sed -i $BAK "/${LIBNAME}/d" $serverPath/php/$version/etc/php.ini
rm -f $extFile
$serverPath/php/init.d/php$version reload
bash ${rootPath}/plugins/php/versions/lib.sh $version restart
echo '==============================================='
echo 'successful!'
}
+2 -2
View File
@@ -72,7 +72,7 @@ Install_lib()
echo "opcache.fast_shutdown=1" >> $serverPath/php/$version/etc/php.ini
echo "opcache.enable_cli=1" >> $serverPath/php/$version/etc/php.ini
$serverPath/php/init.d/php$version reload
bash ${rootPath}/plugins/php/versions/lib.sh $version restart
echo '==========================================================='
echo 'successful!'
}
@@ -96,7 +96,7 @@ Uninstall_lib()
rm -f $extFile
$serverPath/php/init.d/php$version reload
bash ${rootPath}/plugins/php/versions/lib.sh $version restart
echo '==============================================='
echo 'successful!'
}
+104
View File
@@ -0,0 +1,104 @@
#!/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=openssl
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
cd $serverPath/mdserver-web/plugins/php/lib && /bin/bash openssl_10.sh
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}
if [ ! -f "config.m4" ];then
mv config0.m4 config.m4
fi
export PKG_CONFIG_PATH=$serverPath/lib/openssl10/lib/pkgconfig
$serverPath/php/$version/bin/phpize
./configure --with-php-config=$serverPath/php/$version/bin/php-config \
--with-openssl
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
bash ${rootPath}/plugins/php/versions/lib.sh $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
bash ${rootPath}/plugins/php/versions/lib.sh $version restart
echo '==============================================='
echo 'successful!'
}
if [ "$actionType" == 'install' ];then
Install_lib
elif [ "$actionType" == 'uninstall' ];then
Uninstall_lib
fi
+2 -2
View File
@@ -59,7 +59,7 @@ Install_lib()
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
bash ${rootPath}/plugins/php/versions/lib.sh $version restart
echo '==========================================================='
echo 'successful!'
}
@@ -82,7 +82,7 @@ Uninstall_lib()
sed -i $BAK "/${LIBNAME}/d" $serverPath/php/$version/etc/php.ini
rm -f $extFile
$serverPath/php/init.d/php$version reload
bash ${rootPath}/plugins/php/versions/lib.sh $version restart
echo '==============================================='
echo 'successful!'
}
+2 -2
View File
@@ -62,7 +62,7 @@ Install_lib()
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
bash ${rootPath}/plugins/php/versions/lib.sh $version restart
echo '==========================================================='
echo 'successful!'
}
@@ -86,7 +86,7 @@ Uninstall_lib()
sed -i $BAK "/${LIBNAME}/d" $serverPath/php/$version/etc/php.ini
rm -f $extFile
$serverPath/php/init.d/php$version reload
bash ${rootPath}/plugins/php/versions/lib.sh $version restart
echo '==============================================='
echo 'successful!'
}
+2 -2
View File
@@ -69,7 +69,7 @@ Install_lib()
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
bash ${rootPath}/plugins/php/versions/lib.sh $version restart
echo '==========================================================='
echo 'successful!'
}
@@ -93,7 +93,7 @@ Uninstall_lib()
sed -i $BAK "/${_LIBNAME}/d" $serverPath/php/$version/etc/php.ini
rm -f $extFile
$serverPath/php/init.d/php$version reload
bash ${rootPath}/plugins/php/versions/lib.sh $version restart
echo '==============================================='
echo 'successful!'
}
+2 -2
View File
@@ -67,7 +67,7 @@ Install_lib()
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
bash ${rootPath}/plugins/php/versions/lib.sh $version restart
echo '==========================================================='
echo 'successful!'
}
@@ -91,7 +91,7 @@ Uninstall_lib()
sed -i $BAK "/${LIBNAME}/d" $serverPath/php/$version/etc/php.ini
rm -f $extFile
$serverPath/php/init.d/php$version reload
bash ${rootPath}/plugins/php/versions/lib.sh $version restart
echo '==============================================='
echo 'successful!'
}
+2 -2
View File
@@ -79,7 +79,7 @@ Install_lib()
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
bash ${rootPath}/plugins/php/versions/lib.sh $version restart
echo '==========================================================='
echo 'successful!'
}
@@ -103,7 +103,7 @@ Uninstall_lib()
sed -i $BAK "/${LIBNAME}/d" $serverPath/php/$version/etc/php.ini
rm -f $extFile
$serverPath/php/init.d/php$version reload
bash ${rootPath}/plugins/php/versions/lib.sh $version restart
echo '==============================================='
echo 'successful!'
}
+3 -3
View File
@@ -60,9 +60,9 @@ Install_lib()
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
echo "zend_extension=${LIBNAME}.so" >> $serverPath/php/$version/etc/php.ini
$serverPath/php/init.d/php$version reload
bash ${rootPath}/plugins/php/versions/lib.sh $version restart
echo '==========================================================='
echo 'successful!'
}
@@ -85,7 +85,7 @@ Uninstall_lib()
sed -i $BAK "/${LIBNAME}/d" $serverPath/php/$version/etc/php.ini
rm -f $extFile
$serverPath/php/init.d/php$version reload
bash ${rootPath}/plugins/php/versions/lib.sh $version restart
echo '==============================================='
echo 'successful!'
}
+2 -2
View File
@@ -66,7 +66,7 @@ Install_lib()
echo "${LIBNAME}.output_dir=/tmp/xhprof" >> $serverPath/php/$version/etc/php.ini
$serverPath/php/init.d/php$version reload
bash ${rootPath}/plugins/php/versions/lib.sh $version restart
echo '==========================================================='
echo 'successful!'
}
@@ -90,7 +90,7 @@ Uninstall_lib()
rm -f $extFile
$serverPath/php/init.d/php$version reload
bash ${rootPath}/plugins/php/versions/lib.sh $version restart
echo '==============================================='
echo 'successful!'
}
+2 -2
View File
@@ -67,7 +67,7 @@ Install_lib()
echo "extension=${LIBNAME}.so" >> $serverPath/php/$version/etc/php.ini
echo "yaf.use_namespace=1" >> $serverPath/php/$version/etc/php.ini
$serverPath/php/init.d/php$version reload
bash ${rootPath}/plugins/php/versions/lib.sh $version restart
echo '==========================================================='
echo 'successful!'
}
@@ -92,7 +92,7 @@ Uninstall_lib()
sed -i $BAK "/\[yaf\]/d" $serverPath/php/$version/etc/php.ini
rm -f $extFile
$serverPath/php/init.d/php$version reload
bash ${rootPath}/plugins/php/versions/lib.sh $version restart
echo '==============================================='
echo 'successful!'
}
+2 -2
View File
@@ -69,7 +69,7 @@ Install_lib()
echo "extension=${LIBNAME}.so" >> $serverPath/php/$version/etc/php.ini
echo "${LIBNAME}.expose_info=false" >> $serverPath/php/$version/etc/php.ini
$serverPath/php/init.d/php$version reload
bash ${rootPath}/plugins/php/versions/lib.sh $version restart
echo '==========================================================='
echo 'successful!'
}
@@ -94,7 +94,7 @@ Uninstall_lib()
sed -i $BAK "/\[${LIBNAME}\]/d" $serverPath/php/$version/etc/php.ini
rm -f $extFile
$serverPath/php/init.d/php$version reload
bash ${rootPath}/plugins/php/versions/lib.sh $version restart
echo '==============================================='
echo 'successful!'
}
+2 -2
View File
@@ -66,7 +66,7 @@ Install_lib()
echo "zend_loader.obfuscation_level_support=3" >> $serverPath/php/$version/etc/php.ini
echo "zend_loader.license_path=" >> $serverPath/php/$version/etc/php.ini
$serverPath/php/init.d/php$version reload
bash ${rootPath}/plugins/php/versions/lib.sh $version restart
echo '==========================================================='
echo 'successful!'
}
@@ -89,7 +89,7 @@ Uninstall_lib()
sed -i $BAK "/\[Zend ZendGuard Loader\]/d" $serverPath/php/$version/etc/php.ini
rm -f $extFile
$serverPath/php/init.d/php$version reload
bash ${rootPath}/plugins/php/versions/lib.sh $version restart
echo '==============================================='
echo 'successful!'
}
+2 -2
View File
@@ -59,7 +59,7 @@ Install_lib()
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
bash ${rootPath}/plugins/php/versions/lib.sh $version restart
echo '==========================================================='
echo 'successful!'
}
@@ -83,7 +83,7 @@ Uninstall_lib()
sed -i $BAK "/${LIBNAME}/d" $serverPath/php/$version/etc/php.ini
rm -f $extFile
$serverPath/php/init.d/php$version reload
bash ${rootPath}/plugins/php/versions/lib.sh $version restart
echo '==============================================='
echo 'successful!'
}
+3 -2
View File
@@ -68,7 +68,7 @@ Install_lib()
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
bash ${rootPath}/plugins/php/versions/lib.sh $version restart
echo '==========================================================='
echo 'successful!'
}
@@ -91,7 +91,8 @@ Uninstall_lib()
sed -i $BAK "/${LIBNAME}/d" $serverPath/php/$version/etc/php.ini
rm -f $extFile
$serverPath/php/init.d/php$version reload
bash ${rootPath}/plugins/php/versions/lib.sh $version restart
echo '==============================================='
echo 'successful!'
}
+2 -2
View File
@@ -66,7 +66,7 @@ Install_lib()
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
bash ${rootPath}/plugins/php/versions/lib.sh $version restart
echo '==========================================================='
echo 'successful!'
}
@@ -89,7 +89,7 @@ Uninstall_lib()
sed -i $BAK "/${LIBNAME}/d" $serverPath/php/$version/etc/php.ini
rm -f $extFile
$serverPath/php/init.d/php$version reload
bash ${rootPath}/plugins/php/versions/lib.sh $version restart
echo '==============================================='
echo 'successful!'
}
+2 -2
View File
@@ -60,7 +60,7 @@ Install_lib()
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
bash ${rootPath}/plugins/php/versions/lib.sh $version restart
echo '==========================================================='
echo 'successful!'
}
@@ -83,7 +83,7 @@ Uninstall_lib()
sed -i $BAK "/${LIBNAME}/d" $serverPath/php/$version/etc/php.ini
rm -f $extFile
$serverPath/php/init.d/php$version reload
bash ${rootPath}/plugins/php/versions/lib.sh $version restart
echo '==============================================='
echo 'successful!'
}
+2 -2
View File
@@ -64,7 +64,7 @@ Install_lib()
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
bash ${rootPath}/plugins/php/versions/lib.sh $version restart
echo '==========================================================='
echo 'successful!'
}
@@ -87,7 +87,7 @@ Uninstall_lib()
sed -i $BAK "/${LIBNAME}/d" $serverPath/php/$version/etc/php.ini
rm -f $extFile
$serverPath/php/init.d/php$version reload
bash ${rootPath}/plugins/php/versions/lib.sh $version restart
echo '==============================================='
echo 'successful!'
}
+96
View File
@@ -0,0 +1,96 @@
#!/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
LIBNAME=ioncube
LIBV=0
sysName=`uname`
actionType=$1
version=$2
IC_VERSION=${version:0:1}.${version:1:2}
NON_ZTS_FILENAME=`ls $serverPath/php/${version}/lib/php/extensions | grep no-debug-non-zts`
extDir=$serverPath/php/${version}/lib/php/extensions/${NON_ZTS_FILENAME}
extFile=${extDir}/${LIBNAME}.so
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
if [ ! -f "$extFile" ];then
php_lib=$sourcePath/php_lib
mkdir -p $php_lib
if [ ! -f $php_lib/ioncube_loaders_lin.tar.gz ];then
wget -O $php_lib/ioncube_loaders_lin.tar.gz https://downloads.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.tar.gz
cd $php_lib && tar -zxvf ioncube_loaders_lin.tar.gz
fi
cd $php_lib/ioncube
cp -rf $php_lib/ioncube/ioncube_loader_lin_${IC_VERSION}.so $extFile
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 "zend_extension=${LIBNAME}.so" >> $serverPath/php/$version/etc/php.ini
bash ${rootPath}/plugins/php/versions/lib.sh $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},请选择其它版本!"
echo "php-$vphp not install ${LIBNAME}, Plese select other version!"
return
fi
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
bash ${rootPath}/plugins/php/versions/lib.sh $version restart
echo '==============================================='
echo 'successful!'
}
if [ "$actionType" == 'install' ];then
Install_lib
elif [ "$actionType" == 'uninstall' ];then
Uninstall_lib
fi
+2 -2
View File
@@ -61,7 +61,7 @@ Install_lib()
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
bash ${rootPath}/plugins/php/versions/lib.sh $version restart
echo '==========================================================='
echo 'successful!'
}
@@ -84,7 +84,7 @@ Uninstall_lib()
sed -i $BAK "/${LIBNAME}/d" $serverPath/php/$version/etc/php.ini
rm -f $extFile
$serverPath/php/init.d/php$version reload
bash ${rootPath}/plugins/php/versions/lib.sh $version restart
echo '==============================================='
echo 'successful!'
}
+2 -2
View File
@@ -61,7 +61,7 @@ Install_lib()
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
bash ${rootPath}/plugins/php/versions/lib.sh $version restart
echo '==========================================================='
echo 'successful!'
}
@@ -84,7 +84,7 @@ Uninstall_lib()
sed -i $BAK "/${LIBNAME}/d" $serverPath/php/$version/etc/php.ini
rm -f $extFile
$serverPath/php/init.d/php$version reload
bash ${rootPath}/plugins/php/versions/lib.sh $version restart
echo '==============================================='
echo 'successful!'
}
+2 -2
View File
@@ -67,7 +67,7 @@ Install_lib()
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
bash ${rootPath}/plugins/php/versions/lib.sh $version restart
echo '==========================================================='
echo 'successful!'
}
@@ -90,7 +90,7 @@ Uninstall_lib()
sed -i $BAK "/${LIBNAME}/d" $serverPath/php/$version/etc/php.ini
rm -f $extFile
$serverPath/php/init.d/php$version reload
bash ${rootPath}/plugins/php/versions/lib.sh $version restart
echo '==============================================='
echo 'successful!'
}
+2 -2
View File
@@ -71,7 +71,7 @@ Install_lib()
echo "opcache.fast_shutdown=1" >> $serverPath/php/$version/etc/php.ini
echo "opcache.enable_cli=1" >> $serverPath/php/$version/etc/php.ini
$serverPath/php/init.d/php$version reload
bash ${rootPath}/plugins/php/versions/lib.sh $version restart
echo '==========================================================='
echo 'successful!'
}
@@ -95,7 +95,7 @@ Uninstall_lib()
rm -f $extFile
$serverPath/php/init.d/php$version reload
bash ${rootPath}/plugins/php/versions/lib.sh $version restart
echo '==============================================='
echo 'successful!'
}
+104
View File
@@ -0,0 +1,104 @@
#!/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=openssl
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
cd $serverPath/mdserver-web/plugins/php/lib && /bin/bash openssl_10.sh
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}
if [ ! -f "config.m4" ];then
mv config0.m4 config.m4
fi
export PKG_CONFIG_PATH=$serverPath/lib/openssl10/lib/pkgconfig
$serverPath/php/$version/bin/phpize
./configure --with-php-config=$serverPath/php/$version/bin/php-config \
--with-openssl
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
bash ${rootPath}/plugins/php/versions/lib.sh $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
bash ${rootPath}/plugins/php/versions/lib.sh $version restart
echo '==============================================='
echo 'successful!'
}
if [ "$actionType" == 'install' ];then
Install_lib
elif [ "$actionType" == 'uninstall' ];then
Uninstall_lib
fi
+2 -2
View File
@@ -59,7 +59,7 @@ Install_lib()
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
bash ${rootPath}/plugins/php/versions/lib.sh $version restart
echo '==========================================================='
echo 'successful!'
}
@@ -82,7 +82,7 @@ Uninstall_lib()
sed -i $BAK "/${LIBNAME}/d" $serverPath/php/$version/etc/php.ini
rm -f $extFile
$serverPath/php/init.d/php$version reload
bash ${rootPath}/plugins/php/versions/lib.sh $version restart
echo '==============================================='
echo 'successful!'
}
+2 -2
View File
@@ -60,7 +60,7 @@ Install_lib()
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
bash ${rootPath}/plugins/php/versions/lib.sh $version restart
echo '==========================================================='
echo 'successful!'
}
@@ -84,7 +84,7 @@ Uninstall_lib()
sed -i $BAK "/${LIBNAME}/d" $serverPath/php/$version/etc/php.ini
rm -f $extFile
$serverPath/php/init.d/php$version reload
bash ${rootPath}/plugins/php/versions/lib.sh $version restart
echo '==============================================='
echo 'successful!'
}
+2 -2
View File
@@ -69,7 +69,7 @@ Install_lib()
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
bash ${rootPath}/plugins/php/versions/lib.sh $version restart
echo '==========================================================='
echo 'successful!'
}
@@ -93,7 +93,7 @@ Uninstall_lib()
sed -i $BAK "/${_LIBNAME}/d" $serverPath/php/$version/etc/php.ini
rm -f $extFile
$serverPath/php/init.d/php$version reload
bash ${rootPath}/plugins/php/versions/lib.sh $version restart
echo '==============================================='
echo 'successful!'
}
+2 -2
View File
@@ -66,7 +66,7 @@ Install_lib()
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
bash ${rootPath}/plugins/php/versions/lib.sh $version restart
echo '==========================================================='
echo 'successful!'
}
@@ -90,7 +90,7 @@ Uninstall_lib()
sed -i $BAK "/${LIBNAME}/d" $serverPath/php/$version/etc/php.ini
rm -f $extFile
$serverPath/php/init.d/php$version reload
bash ${rootPath}/plugins/php/versions/lib.sh $version restart
echo '==============================================='
echo 'successful!'
}
+2 -2
View File
@@ -76,7 +76,7 @@ Install_lib()
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
bash ${rootPath}/plugins/php/versions/lib.sh $version restart
echo '==========================================================='
echo 'successful!'
}
@@ -99,7 +99,7 @@ Uninstall_lib()
sed -i $BAK "/${LIBNAME}/d" $serverPath/php/$version/etc/php.ini
rm -f $extFile
$serverPath/php/init.d/php$version reload
bash ${rootPath}/plugins/php/versions/lib.sh $version restart
echo '==============================================='
echo 'successful!'
}
+3 -3
View File
@@ -57,9 +57,9 @@ Install_lib()
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
echo "zend_extension=${LIBNAME}.so" >> $serverPath/php/$version/etc/php.ini
$serverPath/php/init.d/php$version reload
bash ${rootPath}/plugins/php/versions/lib.sh $version restart
echo '==========================================================='
echo 'successful!'
}
@@ -82,7 +82,7 @@ Uninstall_lib()
sed -i $BAK "/${LIBNAME}/d" $serverPath/php/$version/etc/php.ini
rm -f $extFile
$serverPath/php/init.d/php$version reload
bash ${rootPath}/plugins/php/versions/lib.sh $version restart
echo '==============================================='
echo 'successful!'
}
+2 -2
View File
@@ -64,7 +64,7 @@ Install_lib()
echo "extension=${LIBNAME}.so" >> $serverPath/php/$version/etc/php.ini
echo "${LIBNAME}.output_dir=/tmp/xhprof" >> $serverPath/php/$version/etc/php.ini
$serverPath/php/init.d/php$version reload
bash ${rootPath}/plugins/php/versions/lib.sh $version restart
echo '==========================================================='
echo 'successful!'
}
@@ -88,7 +88,7 @@ Uninstall_lib()
rm -f $extFile
$serverPath/php/init.d/php$version reload
bash ${rootPath}/plugins/php/versions/lib.sh $version restart
echo '==============================================='
echo 'successful!'
}
+2 -2
View File
@@ -69,7 +69,7 @@ Install_lib()
echo "extension=${LIBNAME}.so" >> $serverPath/php/$version/etc/php.ini
echo "${LIBNAME}.use_namespace=1" >> $serverPath/php/$version/etc/php.ini
$serverPath/php/init.d/php$version reload
bash ${rootPath}/plugins/php/versions/lib.sh $version restart
echo '==========================================================='
echo 'successful!'
}
@@ -93,7 +93,7 @@ Uninstall_lib()
sed -i '_bak' "/\[${LIBNAME}\]/d" $serverPath/php/$version/etc/php.ini
rm -f $extFile
$serverPath/php/init.d/php$version reload
bash ${rootPath}/plugins/php/versions/lib.sh $version restart
echo '==============================================='
echo 'successful!'
}
+2 -2
View File
@@ -71,7 +71,7 @@ Install_lib()
echo "extension=${LIBNAME}.so" >> $serverPath/php/$version/etc/php.ini
echo "${LIBNAME}.expose_info=false" >> $serverPath/php/$version/etc/php.ini
$serverPath/php/init.d/php$version reload
bash ${rootPath}/plugins/php/versions/lib.sh $version restart
echo '==========================================================='
echo 'successful!'
}
@@ -96,7 +96,7 @@ Uninstall_lib()
sed -i '_bak' "/\[${LIBNAME}\]/d" $serverPath/php/$version/etc/php.ini
rm -f $extFile
$serverPath/php/init.d/php$version reload
bash ${rootPath}/plugins/php/versions/lib.sh $version restart
echo '==============================================='
echo 'successful!'
}
+2 -2
View File
@@ -57,7 +57,7 @@ Install_lib()
echo "" >> $serverPath/php/$version/etc/php.ini
echo -e "[Zend ZendGuard Loader]\nzend_extension=ZendGuardLoader.so\nzend_loader.enable=1\nzend_loader.disable_licensing=0\nzend_loader.obfuscation_level_support=3\nzend_loader.license_path=" >> $serverPath/php/$version/etc/php.ini
$serverPath/php/init.d/php$version reload
bash ${rootPath}/plugins/php/versions/lib.sh $version restart
echo '==========================================================='
echo 'successful!'
}
@@ -81,7 +81,7 @@ Uninstall_lib()
sed -i $BAK '/\[Zend ZendGuard Loader\]/d' $serverPath/php/$version/etc/php.ini
rm -f $extFile
$serverPath/php/init.d/php$version reload
bash ${rootPath}/plugins/php/versions/lib.sh $version restart
echo '==============================================='
echo 'successful!'
}
+2 -2
View File
@@ -68,7 +68,7 @@ Install_lib()
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
bash ${rootPath}/plugins/php/versions/lib.sh $version restart
echo '==========================================================='
echo 'successful!'
}
@@ -91,7 +91,7 @@ Uninstall_lib()
sed -i $BAK "/${LIBNAME}/d" $serverPath/php/$version/etc/php.ini
rm -f $extFile
$serverPath/php/init.d/php$version reload
bash ${rootPath}/plugins/php/versions/lib.sh $version restart
echo '==============================================='
echo 'successful!'
}
+2 -2
View File
@@ -66,7 +66,7 @@ Install_lib()
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
bash ${rootPath}/plugins/php/versions/lib.sh $version restart
echo '==========================================================='
echo 'successful!'
}
@@ -89,7 +89,7 @@ Uninstall_lib()
sed -i $BAK "/${LIBNAME}/d" $serverPath/php/$version/etc/php.ini
rm -f $extFile
$serverPath/php/init.d/php$version reload
bash ${rootPath}/plugins/php/versions/lib.sh $version restart
echo '==============================================='
echo 'successful!'
}
+2 -2
View File
@@ -60,7 +60,7 @@ Install_lib()
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
bash ${rootPath}/plugins/php/versions/lib.sh $version restart
echo '==========================================================='
echo 'successful!'
}
@@ -83,7 +83,7 @@ Uninstall_lib()
sed -i $BAK "/${LIBNAME}/d" $serverPath/php/$version/etc/php.ini
rm -f $extFile
$serverPath/php/init.d/php$version reload
bash ${rootPath}/plugins/php/versions/lib.sh $version restart
echo '==============================================='
echo 'successful!'
}
+2 -2
View File
@@ -64,7 +64,7 @@ Install_lib()
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
bash ${rootPath}/plugins/php/versions/lib.sh $version restart
echo '==========================================================='
echo 'successful!'
}
@@ -87,7 +87,7 @@ Uninstall_lib()
sed -i $BAK "/${LIBNAME}/d" $serverPath/php/$version/etc/php.ini
rm -f $extFile
$serverPath/php/init.d/php$version reload
bash ${rootPath}/plugins/php/versions/lib.sh $version restart
echo '==============================================='
echo 'successful!'
}
+96
View File
@@ -0,0 +1,96 @@
#!/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
LIBNAME=ioncube
LIBV=0
sysName=`uname`
actionType=$1
version=$2
IC_VERSION=${version:0:1}.${version:1:2}
NON_ZTS_FILENAME=`ls $serverPath/php/${version}/lib/php/extensions | grep no-debug-non-zts`
extDir=$serverPath/php/${version}/lib/php/extensions/${NON_ZTS_FILENAME}
extFile=${extDir}/${LIBNAME}.so
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
if [ ! -f "$extFile" ];then
php_lib=$sourcePath/php_lib
mkdir -p $php_lib
if [ ! -f $php_lib/ioncube_loaders_lin.tar.gz ];then
wget -O $php_lib/ioncube_loaders_lin.tar.gz https://downloads.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.tar.gz
cd $php_lib && tar -zxvf ioncube_loaders_lin.tar.gz
fi
cd $php_lib/ioncube
cp -rf $php_lib/ioncube/ioncube_loader_lin_${IC_VERSION}.so $extFile
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 "zend_extension=${LIBNAME}.so" >> $serverPath/php/$version/etc/php.ini
bash ${rootPath}/plugins/php/versions/lib.sh $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},请选择其它版本!"
echo "php-$vphp not install ${LIBNAME}, Plese select other version!"
return
fi
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
bash ${rootPath}/plugins/php/versions/lib.sh $version restart
echo '==============================================='
echo 'successful!'
}
if [ "$actionType" == 'install' ];then
Install_lib
elif [ "$actionType" == 'uninstall' ];then
Uninstall_lib
fi
+2 -2
View File
@@ -59,7 +59,7 @@ Install_lib()
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
bash ${rootPath}/plugins/php/versions/lib.sh $version restart
echo '==========================================================='
echo 'successful!'
}
@@ -82,7 +82,7 @@ Uninstall_lib()
sed -i $BAK "/${LIBNAME}/d" $serverPath/php/$version/etc/php.ini
rm -f $extFile
$serverPath/php/init.d/php$version reload
bash ${rootPath}/plugins/php/versions/lib.sh $version restart
echo '==============================================='
echo 'successful!'
}
+2 -2
View File
@@ -61,7 +61,7 @@ Install_lib()
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
bash ${rootPath}/plugins/php/versions/lib.sh $version restart
echo '==========================================================='
echo 'successful!'
}
@@ -84,7 +84,7 @@ Uninstall_lib()
sed -i $BAK "/${LIBNAME}/d" $serverPath/php/$version/etc/php.ini
rm -f $extFile
$serverPath/php/init.d/php$version reload
bash ${rootPath}/plugins/php/versions/lib.sh $version restart
echo '==============================================='
echo 'successful!'
}
+2 -2
View File
@@ -68,7 +68,7 @@ Install_lib()
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
bash ${rootPath}/plugins/php/versions/lib.sh $version restart
echo '==========================================================='
echo 'successful!'
}
@@ -91,7 +91,7 @@ Uninstall_lib()
sed -i $BAK "/${LIBNAME}/d" $serverPath/php/$version/etc/php.ini
rm -f $extFile
$serverPath/php/init.d/php$version reload
bash ${rootPath}/plugins/php/versions/lib.sh $version restart
echo '==============================================='
echo 'successful!'
}

Some files were not shown because too many files have changed in this diff Show More