Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
83cf0c2604 | ||
|
|
7999108b91 | ||
|
|
b80de25598 | ||
|
|
7c25ae0ec2 | ||
|
|
84e9c4a484 | ||
|
|
5178e11e44 | ||
|
|
0e7c2769c8 | ||
|
|
6651a706b7 | ||
|
|
a81f922592 | ||
|
|
2b87887054 | ||
|
|
7859bfb451 | ||
|
|
35369f8f41 | ||
|
|
a47166d547 | ||
|
|
457a69b34a | ||
|
|
881f571902 | ||
|
|
d889c3305f | ||
|
|
cb793d5f3f | ||
|
|
b4882aa0fc | ||
|
|
ef3b5b2a6c | ||
|
|
d4501b736b | ||
|
|
261e24390f | ||
|
|
10abbd7efd | ||
|
|
e2196735d9 | ||
|
|
dbbc243359 | ||
|
|
94bb8e31cf | ||
|
|
282bcccf39 | ||
|
|
886f6c2369 | ||
|
|
ab822f0572 | ||
|
|
4ec2355182 | ||
|
|
a4237ca213 | ||
|
|
4615b70c60 | ||
|
|
97b9d12769 | ||
|
|
35a7c2d96f | ||
|
|
11ea1e2e1f | ||
|
|
1860dda320 | ||
|
|
5610b1b1da | ||
|
|
422dea0e3f | ||
|
|
d52a355cc9 | ||
|
|
389d87c2b5 | ||
|
|
7ef8322731 | ||
|
|
d1a0b32bf6 | ||
|
|
295cb399e3 | ||
|
|
db9477c22e | ||
|
|
b2ae6b67d6 | ||
|
|
bf5f0cecff | ||
|
|
251503952d | ||
|
|
60445a565d | ||
|
|
6a8db02aa7 | ||
|
|
ac50b335c3 | ||
|
|
c9826d5daf | ||
|
|
ada8225e05 | ||
|
|
613ca4bce0 | ||
|
|
1bdfb0625a | ||
|
|
ad2e33fcd2 | ||
|
|
6e846a4a51 | ||
|
|
dc76f0ca33 | ||
|
|
c619f00c54 | ||
|
|
015b132b85 | ||
|
|
4e4b4ad308 | ||
|
|
1226caaa39 | ||
|
|
5a92027f20 | ||
|
|
ea6ed08461 | ||
|
|
009231bbcf | ||
|
|
d6fa8ca2a5 | ||
|
|
e3bfca777d | ||
|
|
292fb9362a | ||
|
|
f68a8c88d7 | ||
|
|
4175a71547 | ||
|
|
0a5680de12 | ||
|
|
b3df13210d | ||
|
|
55c9cb8856 | ||
|
|
740ad102ea | ||
|
|
1af0097673 | ||
|
|
b86a2f4243 | ||
|
|
9500e4a39d | ||
|
|
73b5d91ddc | ||
|
|
645cf21898 | ||
|
|
04e4e5a9dd | ||
|
|
3d215ba96d | ||
|
|
9b7722f847 | ||
|
|
040a6c0ed1 | ||
|
|
ef2a04e886 | ||
|
|
e656c64fee | ||
|
|
0ee24a763a | ||
|
|
26120018c6 | ||
|
|
ae78b0aa8c | ||
|
|
3cca69ae9f | ||
|
|
422460c422 | ||
|
|
47a60b3465 | ||
|
|
701ff6f817 | ||
|
|
385fa4bb5d | ||
|
|
f410727d42 | ||
|
|
f9baee0a4a | ||
|
|
c97e1ad3a7 | ||
|
|
deaa193478 | ||
|
|
e290af5403 | ||
|
|
f6f160883c | ||
|
|
0a2f8c9765 | ||
|
|
788a672e74 | ||
|
|
2a078d3290 | ||
|
|
03d3761805 | ||
|
|
6d16ae5767 | ||
|
|
66c9828b68 | ||
|
|
cf2ea6e16c | ||
|
|
b2533943ed | ||
|
|
5c9ccd9bd2 | ||
|
|
fa48db5f1b | ||
|
|
79a45082c1 | ||
|
|
7998afb78a | ||
|
|
492f875205 | ||
|
|
5e767fde08 | ||
|
|
15acc8c67c | ||
|
|
6234188ceb | ||
|
|
36842c8b2c | ||
|
|
089de80c59 | ||
|
|
c60e9aabcd | ||
|
|
3195f915f5 | ||
|
|
24191e082a | ||
|
|
c2745a5f16 | ||
|
|
7d03e6ddf3 | ||
|
|
77cfc12013 | ||
|
|
0bf9c06ef2 | ||
|
|
d2b40b3399 | ||
|
|
482f4072c7 | ||
|
|
4879fee9a8 | ||
|
|
51307c31f8 | ||
|
|
db451b630c | ||
|
|
400ea68cc9 | ||
|
|
078c755684 | ||
|
|
f17c89605f | ||
|
|
5f961febac | ||
|
|
1fb2c3ed5d | ||
|
|
acc6cd0c73 | ||
|
|
4e27082225 | ||
|
|
6563bb0044 | ||
|
|
d4b2a1214e | ||
|
|
097fb3b4cb | ||
|
|
f3f69767a1 | ||
|
|
dc149ac022 | ||
|
|
37cde7a7af | ||
|
|
e320104fb8 | ||
|
|
af4ad33031 | ||
|
|
2038111a11 | ||
|
|
3481e660a3 | ||
|
|
4651bf782c | ||
|
|
608a78ac67 | ||
|
|
4a12128315 | ||
|
|
746b3295cb | ||
|
|
3d42cf67d7 | ||
|
|
b7f5b7b5e5 | ||
|
|
5e548f7899 | ||
|
|
fb68ad7705 | ||
|
|
e959ae2494 | ||
|
|
3a6e84119f | ||
|
|
4f3f7a70a9 | ||
|
|
e1bf1e306d | ||
|
|
c9333a3023 | ||
|
|
840fd5243a | ||
|
|
dde8fb3202 | ||
|
|
0f5ef505d0 | ||
|
|
1673a23455 | ||
|
|
b4b16ada27 | ||
|
|
a4d75bfc04 | ||
|
|
61bd4f799b | ||
|
|
002a3ea79e | ||
|
|
5dce56357b | ||
|
|
89ab800565 | ||
|
|
349741b31b | ||
|
|
725b398da9 | ||
|
|
ce9f53dddb | ||
|
|
fc37413d91 | ||
|
|
ba39c39622 | ||
|
|
6c5ee78b18 | ||
|
|
eafa575e8e | ||
|
|
a3dd458cb2 | ||
|
|
c5cb8b65f3 | ||
|
|
994b93852e | ||
|
|
912eda2cb8 | ||
|
|
0461fabab0 | ||
|
|
0324872499 | ||
|
|
5877644570 | ||
|
|
f292fdd354 | ||
|
|
85ce4dc462 | ||
|
|
a9d3aa4962 | ||
|
|
9a562934e5 | ||
|
|
784304f639 | ||
|
|
582792c2bf | ||
|
|
946523a73d | ||
|
|
39021dca1e | ||
|
|
e240ef713b | ||
|
|
2b1f88ae0f | ||
|
|
8259823451 | ||
|
|
05109a500d | ||
|
|
78b156aeed | ||
|
|
39789bcc33 | ||
|
|
310c8a57e7 | ||
|
|
3b947d6446 | ||
|
|
d163c84916 | ||
|
|
ef43ceab48 | ||
|
|
665952869a | ||
|
|
942a1fbf1a | ||
|
|
0c05f87acd | ||
|
|
ef856a1420 | ||
|
|
0ea666bb7c | ||
|
|
5fc3a8607f | ||
|
|
163ca52b7f | ||
|
|
dbcf62edb1 | ||
|
|
6e1ef774df | ||
|
|
84e646dbe4 | ||
|
|
705ea56813 | ||
|
|
91ae7244b0 | ||
|
|
1539504258 | ||
|
|
1ef899d11e | ||
|
|
e36df4fff5 | ||
|
|
76a1fed75d | ||
|
|
338ccef6d6 | ||
|
|
1fa7fbda45 | ||
|
|
4459d296eb | ||
|
|
a9f7a47022 | ||
|
|
e1e69a4677 | ||
|
|
6827de3f67 | ||
|
|
bffd4c1150 | ||
|
|
ad44c255cb | ||
|
|
c884197f2e | ||
|
|
1bc335d715 | ||
|
|
a10f5a3337 | ||
|
|
c2c413a9ef | ||
|
|
c9eea53ff5 | ||
|
|
e176ac2e8d | ||
|
|
522f9f22e4 | ||
|
|
8fded1c678 | ||
|
|
2b0782f125 | ||
|
|
f7c2e38a5e | ||
|
|
93d3fc3cef | ||
|
|
0e200e8c12 | ||
|
|
28ddb57c8e | ||
|
|
348ecd938e | ||
|
|
6de200a294 | ||
|
|
8b0dc43f74 | ||
|
|
e14d8109f2 | ||
|
|
ea8b829c6e | ||
|
|
faf637aae1 | ||
|
|
bb69c92a9c | ||
|
|
3886888843 | ||
|
|
1bd0a38f6b | ||
|
|
ac7fe66734 | ||
|
|
3365ab9a49 | ||
|
|
3cfaa5361f | ||
|
|
43800b6578 | ||
|
|
0891e206d5 | ||
|
|
8f6aae7e4c | ||
|
|
d860405b16 | ||
|
|
df4f1aa28b | ||
|
|
b464c848a9 | ||
|
|
04780d8094 | ||
|
|
e41604499a | ||
|
|
ef90ba7aab | ||
|
|
b5954be201 | ||
|
|
5d7b37cb18 | ||
|
|
71026d74e9 | ||
|
|
d656d07487 | ||
|
|
3bf395c86f | ||
|
|
f841a89940 | ||
|
|
287de96277 | ||
|
|
860bcd0c9d | ||
|
|
73f6354332 | ||
|
|
9770821628 | ||
|
|
dff57a4b13 | ||
|
|
cfed5e813d | ||
|
|
2518e53abc | ||
|
|
bf970dbd02 | ||
|
|
aa583e4586 | ||
|
|
07a33f1a5f | ||
|
|
bd1eff9fc8 | ||
|
|
ded6dad023 | ||
|
|
52f7bdd65d | ||
|
|
6874bfc059 | ||
|
|
bef439ce55 | ||
|
|
726c684a94 | ||
|
|
e6b9fd8a66 | ||
|
|
350a1e8b61 | ||
|
|
b904ef4e8a | ||
|
|
d64040abb7 |
@@ -116,6 +116,9 @@ data/iplist.txt
|
||||
data/json/index.json
|
||||
data/json/config.json
|
||||
data/site.pl
|
||||
data/admin_path.pl
|
||||
data/close.pl
|
||||
data/admin_path.pl
|
||||
data/close.pl
|
||||
ssl/input.pl
|
||||
data/datadir.pl
|
||||
data/502Task.pl
|
||||
plugins/qbittorrent/
|
||||
|
||||
@@ -1,7 +1,21 @@
|
||||
# mdserver-web
|
||||
简单的Linux面板
|
||||
简单的Linux面板,感谢bt.cn写出如此好的web管理软件。我一看到,就知道这是我一直想要的页面化管理方式。
|
||||
复制了后台管理界面,按照自己想要的方式写了一版。
|
||||
|
||||
### 自动安装
|
||||
```
|
||||
curl -fsSL https://raw.githubusercontent.com/midoks/mdserver-web/master/scripts/install.sh | sh
|
||||
```
|
||||
```
|
||||
|
||||
### 更新
|
||||
|
||||
```
|
||||
curl -fsSL https://raw.githubusercontent.com/midoks/mdserver-web/master/scripts/update.sh | sh
|
||||
```
|
||||
|
||||
### 无图不真相
|
||||
[](/route/static/mdw.jpg)
|
||||
|
||||
### wiki
|
||||
[了解更多...](https://github.com/midoks/mdserver-web/wiki)
|
||||
|
||||
|
||||
@@ -68,6 +68,8 @@ def initInitD():
|
||||
import shutil
|
||||
shutil.copyfile(script_bin, initd_bin)
|
||||
public.execShell('chmod +x ' + initd_bin)
|
||||
#加入自启动
|
||||
public.execShell('chkconfig --add mw')
|
||||
|
||||
|
||||
def initUserInfo():
|
||||
|
||||
@@ -15,8 +15,9 @@ from flask import request
|
||||
|
||||
class config_api:
|
||||
|
||||
__version = '0.0.5'
|
||||
|
||||
# 本版解决自启动问题
|
||||
# 文件管理重命名
|
||||
__version = '0.7.3'
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
@@ -64,14 +65,14 @@ class config_api:
|
||||
isSave = public.M('panel').where(
|
||||
'(title=? OR url=?) AND id!=?', (title, url, mid)).count()
|
||||
if isSave:
|
||||
return public.returnMsg(False, '备注或面板地址重复!')
|
||||
return public.returnJson(False, '备注或面板地址重复!')
|
||||
|
||||
# 更新到数据库
|
||||
isRe = public.M('panel').where('id=?', (mid,)).save(
|
||||
'title,url,username,password', (title, url, username, password))
|
||||
if isRe:
|
||||
return public.returnMsg(True, '修改成功!')
|
||||
return public.returnMsg(False, '修改失败!')
|
||||
return public.returnJson(True, '修改成功!')
|
||||
return public.returnJson(False, '修改失败!')
|
||||
|
||||
def syncDateApi(self):
|
||||
if public.isAppleSystem():
|
||||
|
||||
@@ -13,6 +13,7 @@ import shutil
|
||||
from flask import request
|
||||
from flask import send_file, send_from_directory
|
||||
from flask import make_response
|
||||
from flask import session
|
||||
|
||||
|
||||
class files_api:
|
||||
@@ -51,7 +52,7 @@ class files_api:
|
||||
if not os.path.exists(filename):
|
||||
return ''
|
||||
response = make_response(send_from_directory(
|
||||
os.path.dirname(filename), os.path.basename(filename), as_attachment=True))
|
||||
os.path.dirname(filename).encode('utf-8'), os.path.basename(filename).encode('utf-8'), as_attachment=True))
|
||||
return response
|
||||
|
||||
def zipApi(self):
|
||||
@@ -61,6 +62,27 @@ class files_api:
|
||||
path = request.form.get('path', '').encode('utf-8')
|
||||
return self.zip(sfile, dfile, stype, path)
|
||||
|
||||
# 移动文件或目录
|
||||
def mvFileApi(self):
|
||||
sfile = request.form.get('sfile', '').encode('utf-8')
|
||||
dfile = request.form.get('dfile', '').encode('utf-8')
|
||||
if not self.checkFileName(dfile):
|
||||
return public.returnJson(False, '文件名中不能包含特殊字符!')
|
||||
if not os.path.exists(sfile):
|
||||
return public.returnJson(False, '指定文件不存在!')
|
||||
|
||||
if not self.checkDir(sfile):
|
||||
return public.returnJson(False, 'FILE_DANGER')
|
||||
|
||||
import shutil
|
||||
try:
|
||||
shutil.move(sfile, dfile)
|
||||
msg = public.getInfo('移动文件或目录[{1}]到[{2}]成功!', (sfile, dfile,))
|
||||
public.writeLog('文件管理', msg)
|
||||
return public.returnJson(True, '移动文件或目录成功!')
|
||||
except:
|
||||
return public.returnJson(False, '移动文件或目录失败!')
|
||||
|
||||
def deleteApi(self):
|
||||
path = request.form.get('path', '').encode('utf-8')
|
||||
return self.delete(path)
|
||||
@@ -70,6 +92,32 @@ class files_api:
|
||||
data = self.getAccess(filename)
|
||||
return public.getJson(data)
|
||||
|
||||
def setFileAccessApi(self):
|
||||
|
||||
if public.isAppleSystem():
|
||||
return public.returnJson(True, '开发机不设置!')
|
||||
|
||||
filename = request.form.get('filename', '').encode('utf-8')
|
||||
user = request.form.get('user', '').encode('utf-8')
|
||||
access = request.form.get('access', '755')
|
||||
sall = '-R'
|
||||
try:
|
||||
if not self.checkDir(filename):
|
||||
return public.returnJson(False, '请不要花样作死')
|
||||
|
||||
if not os.path.exists(filename):
|
||||
return public.returnJson(False, '指定文件不存在!')
|
||||
|
||||
os.system('chmod ' + sall + ' ' + access + " '" + filename + "'")
|
||||
os.system('chown ' + sall + ' ' + user +
|
||||
':' + user + " '" + filename + "'")
|
||||
msg = public.getInfo(
|
||||
'设置[{1}]权限为[{2}]所有者为[{3}]', (filename, access, user,))
|
||||
public.writeLog('文件管理', msg)
|
||||
return public.returnJson(True, '设置成功!')
|
||||
except:
|
||||
return public.returnJson(False, '设置失败!')
|
||||
|
||||
def getDirSizeApi(self):
|
||||
path = request.form.get('path', '').encode('utf-8')
|
||||
tmp = self.getDirSize(path)
|
||||
@@ -82,6 +130,10 @@ class files_api:
|
||||
search = request.args.get('search', '').strip().lower()
|
||||
page = request.args.get('p', '1').strip().lower()
|
||||
row = request.args.get('showRow', '10')
|
||||
disk = request.form.get('disk', '')
|
||||
if disk == 'True':
|
||||
row = 1000
|
||||
|
||||
return self.getDir(path, int(page), int(row), search)
|
||||
|
||||
def createFileApi(self):
|
||||
@@ -310,7 +362,7 @@ done
|
||||
if os.path.exists('data/recycle_bin.pl'):
|
||||
if self.mvRecycleBin(path):
|
||||
return public.returnJson(True, '已将文件移动到回收站!')
|
||||
os.remove(path)
|
||||
public.execShell('rm -rf ' + path)
|
||||
public.writeLog('文件管理', '删除文件成功!', (path,))
|
||||
return public.returnJson(True, '删除文件成功!')
|
||||
except:
|
||||
@@ -325,8 +377,189 @@ done
|
||||
tmp = self.getDirSize(logPath)
|
||||
return public.returnJson(True, tmp[0].split()[0])
|
||||
|
||||
def setBatchDataApi(self):
|
||||
path = request.form.get('path', '').encode('utf-8')
|
||||
stype = request.form.get('type', '').encode('utf-8')
|
||||
access = request.form.get('access', '').encode('utf-8')
|
||||
user = request.form.get('user', '').encode('utf-8')
|
||||
data = request.form.get('data')
|
||||
if stype == '1' or stype == '2':
|
||||
session['selected'] = {
|
||||
'path': path,
|
||||
'type': stype,
|
||||
'access': access,
|
||||
'user': user,
|
||||
'data': data
|
||||
}
|
||||
return public.returnJson(True, '标记成功,请在目标目录点击粘贴所有按钮!')
|
||||
elif stype == '3':
|
||||
for key in json.loads(data):
|
||||
try:
|
||||
key = key.encode('utf-8')
|
||||
filename = path + '/' + key
|
||||
if not self.checkDir(filename):
|
||||
return public.returnJson(False, 'FILE_DANGER')
|
||||
os.system('chmod -R ' + access + " '" + filename + "'")
|
||||
os.system('chown -R ' + user + ':' +
|
||||
user + " '" + filename + "'")
|
||||
except:
|
||||
continue
|
||||
public.writeLog('文件管理', '批量设置权限成功!')
|
||||
return public.returnJson(True, '批量设置权限成功!')
|
||||
else:
|
||||
import shutil
|
||||
isRecyle = os.path.exists('data/recycle_bin.pl')
|
||||
data = json.loads(data)
|
||||
l = len(data)
|
||||
i = 0
|
||||
for key in data:
|
||||
try:
|
||||
filename = path + '/' + key.encode('utf-8')
|
||||
topath = filename
|
||||
if not os.path.exists(filename):
|
||||
continue
|
||||
|
||||
i += 1
|
||||
public.writeSpeed(key, i, l)
|
||||
if os.path.isdir(filename):
|
||||
if not self.checkDir(filename):
|
||||
return public.returnJson(False, '请不要花样作死!')
|
||||
if isRecyle:
|
||||
self.mvRecycleBin(topath)
|
||||
else:
|
||||
shutil.rmtree(filename)
|
||||
else:
|
||||
if key == '.user.ini':
|
||||
os.system('which chattr && chattr -i ' + filename)
|
||||
if isRecyle:
|
||||
self.mvRecycleBin(topath)
|
||||
else:
|
||||
os.remove(filename)
|
||||
except:
|
||||
continue
|
||||
public.writeSpeed(None, 0, 0)
|
||||
public.writeLog('文件管理', '批量删除成功!')
|
||||
return public.returnJson(True, '批量删除成功!')
|
||||
|
||||
def checkExistsFilesApi(self):
|
||||
dfile = request.form.get('dfile', '').encode('utf-8')
|
||||
filename = request.form.get('filename', '').encode('utf-8')
|
||||
data = []
|
||||
filesx = []
|
||||
if filename == '':
|
||||
filesx = json.loads(session['selected']['data'])
|
||||
else:
|
||||
filesx.append(filename)
|
||||
|
||||
print filesx
|
||||
|
||||
for fn in filesx:
|
||||
if fn == '.':
|
||||
continue
|
||||
filename = dfile + '/' + fn
|
||||
if os.path.exists(filename):
|
||||
tmp = {}
|
||||
stat = os.stat(filename)
|
||||
tmp['filename'] = fn
|
||||
tmp['size'] = os.path.getsize(filename)
|
||||
tmp['mtime'] = str(int(stat.st_mtime))
|
||||
data.append(tmp)
|
||||
return public.returnJson(True, 'ok', data)
|
||||
|
||||
def batchPasteApi(self):
|
||||
path = request.form.get('path', '').encode('utf-8')
|
||||
stype = request.form.get('type', '').encode('utf-8')
|
||||
# filename = request.form.get('filename', '').encode('utf-8')
|
||||
import shutil
|
||||
if not self.checkDir(path):
|
||||
return public.returnJson(False, '请不要花样作死!')
|
||||
i = 0
|
||||
myfiles = json.loads(session['selected']['data'])
|
||||
l = len(myfiles)
|
||||
if stype == '1':
|
||||
for key in myfiles:
|
||||
i += 1
|
||||
public.writeSpeed(key, i, l)
|
||||
try:
|
||||
|
||||
sfile = session['selected'][
|
||||
'path'] + '/' + key.encode('utf-8')
|
||||
dfile = path + '/' + key.encode('utf-8')
|
||||
|
||||
if os.path.isdir(sfile):
|
||||
shutil.copytree(sfile, dfile)
|
||||
else:
|
||||
shutil.copyfile(sfile, dfile)
|
||||
stat = os.stat(sfile)
|
||||
os.chown(dfile, stat.st_uid, stat.st_gid)
|
||||
except:
|
||||
continue
|
||||
msg = public.getInfo('从[{1}]批量复制到[{2}]成功',
|
||||
(session['selected']['path'], path,))
|
||||
public.writeLog('文件管理', msg)
|
||||
else:
|
||||
for key in myfiles:
|
||||
try:
|
||||
i += 1
|
||||
public.writeSpeed(key, i, l)
|
||||
|
||||
sfile = session['selected'][
|
||||
'path'] + '/' + key.encode('utf-8')
|
||||
dfile = path + '/' + key.encode('utf-8')
|
||||
|
||||
shutil.move(sfile, dfile)
|
||||
except:
|
||||
continue
|
||||
msg = public.getInfo('从[{1}]批量移动到[{2}]成功',
|
||||
(session['selected']['path'], path,))
|
||||
public.writeLog('文件管理', msg)
|
||||
public.writeSpeed(None, 0, 0)
|
||||
errorCount = len(myfiles) - i
|
||||
del(session['selected'])
|
||||
msg = public.getInfo('批量操作成功[{1}],失败[{2}]', (str(i), str(errorCount)))
|
||||
return public.returnJson(True, msg)
|
||||
|
||||
def copyFileApi(self):
|
||||
sfile = request.form.get('sfile', '').encode('utf-8')
|
||||
dfile = request.form.get('dfile', '').encode('utf-8')
|
||||
|
||||
if not os.path.exists(sfile):
|
||||
return public.returnJson(False, '指定文件不存在!')
|
||||
|
||||
if os.path.isdir(sfile):
|
||||
return self.copyDir(get)
|
||||
|
||||
import shutil
|
||||
try:
|
||||
shutil.copyfile(sfile, dfile)
|
||||
msg = public.getInfo('复制文件[{1}]到[{2}]成功!', (sfile, dfile,))
|
||||
public.writeLog('文件管理', msg)
|
||||
stat = os.stat(sfile)
|
||||
os.chown(dfile, stat.st_uid, stat.st_gid)
|
||||
return public.returnJson(True, '文件复制成功!')
|
||||
except:
|
||||
return public.returnJson(False, '文件复制失败!')
|
||||
|
||||
##### ----- end ----- ###
|
||||
|
||||
def copyDir(self, sfile, dfile):
|
||||
|
||||
if not os.path.exists(sfile):
|
||||
return public.returnJson(False, '指定目录不存在!')
|
||||
|
||||
if os.path.exists(dfile):
|
||||
return public.returnJson(False, '指定目录已存在!')
|
||||
import shutil
|
||||
try:
|
||||
shutil.copytree(sfile, dfile)
|
||||
stat = os.stat(sfile)
|
||||
os.chown(dfile, stat.st_uid, stat.st_gid)
|
||||
msg = public.getInfo('复制目录[{1}]到[{2}]成功!', (sfile, dfile))
|
||||
public.writeLog('文件管理', msg)
|
||||
return public.returnJson(True, '目录复制成功!')
|
||||
except:
|
||||
return public.returnJson(False, '目录复制失败!')
|
||||
|
||||
# 检查敏感目录
|
||||
def checkDir(self, path):
|
||||
path = path.replace('//', '/')
|
||||
@@ -397,11 +630,11 @@ done
|
||||
try:
|
||||
import shutil
|
||||
shutil.move(path, rFile)
|
||||
public.writeLog('TYPE_FILE', public.getInfo(
|
||||
public.writeLog('文件管理', public.getInfo(
|
||||
'移动文件[{1}]到回收站成功!', (path)))
|
||||
return True
|
||||
except:
|
||||
public.writeLog('TYPE_FILE', public.getInfo(
|
||||
public.writeLog('文件管理', public.getInfo(
|
||||
'移动文件[{1}]到回收站失败!', (path)))
|
||||
return False
|
||||
|
||||
@@ -477,7 +710,7 @@ done
|
||||
fp.write(data)
|
||||
fp.close()
|
||||
|
||||
public.writeLog('TYPE_FILE', '文件保存成功', (path,))
|
||||
public.writeLog('文件管理', '文件保存成功', (path,))
|
||||
return public.returnJson(True, '文件保存成功')
|
||||
except Exception as ex:
|
||||
return public.returnJson(False, 'FILE_SAVE_ERR:' + str(ex))
|
||||
@@ -501,7 +734,7 @@ done
|
||||
os.system("cd '" + path + "' && tar -zcvf '" +
|
||||
dfile + "' " + sfiles + " > " + tmps + " 2>&1")
|
||||
self.setFileAccept(dfile)
|
||||
public.writeLog("TYPE_FILE", '文件压缩成功!', (sfile, dfile))
|
||||
public.writeLog("文件管理", '文件压缩成功!', (sfile, dfile))
|
||||
return public.returnJson(True, '文件压缩成功!')
|
||||
except:
|
||||
return public.returnJson(False, '文件压缩失败!')
|
||||
@@ -520,7 +753,7 @@ done
|
||||
if self.mvRecycleBin(path):
|
||||
return public.returnJson(True, '已将文件移动到回收站!')
|
||||
os.remove(path)
|
||||
public.writeLog('TYPE_FILE', public.getInfo(
|
||||
public.writeLog('文件管理', public.getInfo(
|
||||
'删除文件[{1}]成功!', (path)))
|
||||
return public.returnJson(True, '删除文件成功!')
|
||||
except:
|
||||
|
||||
@@ -289,6 +289,7 @@ class firewall_api:
|
||||
return
|
||||
if self.__isFirewalld:
|
||||
public.execShell('systemctl stop firewalld.service')
|
||||
public.execShell('systemctl disabled firewalld.service')
|
||||
elif self.__isMac:
|
||||
pass
|
||||
else:
|
||||
@@ -300,6 +301,7 @@ class firewall_api:
|
||||
return
|
||||
if self.__isFirewalld:
|
||||
public.execShell('systemctl start firewalld.service')
|
||||
public.execShell('systemctl enable firewalld.service')
|
||||
elif self.__isMac:
|
||||
pass
|
||||
else:
|
||||
|
||||
@@ -98,10 +98,10 @@ class plugins_api:
|
||||
return public.returnJson(False, '缺少版本信息!', ())
|
||||
|
||||
infoJsonPos = self.__plugin_dir + '/' + name + '/' + 'info.json'
|
||||
print infoJsonPos
|
||||
# print infoJsonPos
|
||||
|
||||
if not os.path.exists(infoJsonPos):
|
||||
return public.retJson(False, '配置文件不存在!', ())
|
||||
return public.returnJson(False, '配置文件不存在!', ())
|
||||
|
||||
pluginInfo = json.loads(public.readFile(infoJsonPos))
|
||||
|
||||
@@ -115,6 +115,34 @@ class plugins_api:
|
||||
public.M('tasks').add('id,name,type,status,addtime, execstr', taskAdd)
|
||||
return public.returnJson(True, '已将安装任务添加到队列!')
|
||||
|
||||
def uninstallOldApi(self):
|
||||
rundir = public.getRunDir()
|
||||
name = request.form.get('name', '')
|
||||
version = request.form.get('version', '')
|
||||
if name.strip() == '':
|
||||
return public.returnJson(False, "缺少插件名称!", ())
|
||||
|
||||
if version.strip() == '':
|
||||
return public.returnJson(False, "缺少版本信息!", ())
|
||||
|
||||
infoJsonPos = self.__plugin_dir + '/' + name + '/' + 'info.json'
|
||||
|
||||
if not os.path.exists(infoJsonPos):
|
||||
return public.returnJson(False, "配置文件不存在!", ())
|
||||
|
||||
pluginInfo = json.loads(public.readFile(infoJsonPos))
|
||||
|
||||
execstr = "cd " + os.getcwd() + "/plugins/" + \
|
||||
name + " && /bin/bash " + pluginInfo["shell"] \
|
||||
+ " uninstall " + version
|
||||
|
||||
taskAdd = (None, '卸载[' + name + '-' + version + ']',
|
||||
'execshell', '0', time.strftime('%Y-%m-%d %H:%M:%S'), execstr)
|
||||
|
||||
public.M('tasks').add('id,name,type,status,addtime, execstr', taskAdd)
|
||||
return public.returnJson(True, '已将卸载任务添加到队列!')
|
||||
|
||||
# 卸载时间短,不加入任务中...
|
||||
def uninstallApi(self):
|
||||
rundir = public.getRunDir()
|
||||
name = request.form.get('name', '')
|
||||
@@ -128,7 +156,7 @@ class plugins_api:
|
||||
infoJsonPos = self.__plugin_dir + '/' + name + '/' + 'info.json'
|
||||
|
||||
if not os.path.exists(infoJsonPos):
|
||||
return public.retJson(False, "配置文件不存在!", ())
|
||||
return public.returnJson(False, "配置文件不存在!", ())
|
||||
|
||||
pluginInfo = json.loads(public.readFile(infoJsonPos))
|
||||
|
||||
@@ -136,11 +164,15 @@ class plugins_api:
|
||||
name + " && /bin/bash " + pluginInfo["shell"] \
|
||||
+ " uninstall " + version
|
||||
|
||||
taskAdd = (None, '卸载[' + name + '-' + version + ']',
|
||||
'execshell', '0', time.strftime('%Y-%m-%d %H:%M:%S'), execstr)
|
||||
|
||||
public.M('tasks').add('id,name,type,status,addtime, execstr', taskAdd)
|
||||
return public.returnJson(True, '已将卸载任务添加到队列!')
|
||||
data = public.execShell(execstr)
|
||||
if public.isAppleSystem():
|
||||
print execstr
|
||||
print data[0], data[1]
|
||||
return public.returnJson(True, '卸载执行成功!')
|
||||
# if data[1] == '':
|
||||
# return public.returnJson(True, '已将卸载成功!')
|
||||
# else:
|
||||
# return public.returnJson(False, '卸载出现错误信息!' + data[1])
|
||||
|
||||
def checkApi(self):
|
||||
name = request.form.get('name', '')
|
||||
@@ -177,6 +209,17 @@ class plugins_api:
|
||||
return public.returnJson(True, "OK", data[0].strip())
|
||||
return public.returnJson(False, data[1].strip())
|
||||
|
||||
def callbackApi(self):
|
||||
name = request.form.get('name', '')
|
||||
func = request.form.get('func', '')
|
||||
args = request.form.get('args', '')
|
||||
script = request.form.get('script', 'index')
|
||||
|
||||
data = self.callback(name, func, args, script)
|
||||
if data[0]:
|
||||
return public.returnJson(True, "OK", data[1])
|
||||
return public.returnJson(False, data[1])
|
||||
|
||||
def updateZipApi(self):
|
||||
tmp_path = public.getRootDir() + '/temp'
|
||||
if not os.path.exists(tmp_path):
|
||||
@@ -228,6 +271,9 @@ class plugins_api:
|
||||
except:
|
||||
public.execShell("rm -rf " + tmp_path)
|
||||
return public.returnJson(False, '在压缩包中没有找到插件信息,请检查插件包!')
|
||||
protectPlist = ('openresty', 'mysql', 'php', 'csvn', 'gogs', 'pureftp')
|
||||
if data['name'] in protectPlist:
|
||||
return public.returnJson(False, '[' + data['name'] + '],重要插件不可修改!')
|
||||
return public.getJson(data)
|
||||
|
||||
def inputZipApi(self):
|
||||
@@ -271,17 +317,10 @@ class plugins_api:
|
||||
return True
|
||||
|
||||
# 检查是否正在安装
|
||||
def checkSetupTask(self, sName):
|
||||
sName = ''
|
||||
version = ''
|
||||
def checkSetupTask(self, sName, sVer, sCoexist):
|
||||
if not self.__tasks:
|
||||
self.__tasks = public.M('tasks').where(
|
||||
"status!=?", ('1',)).field('status,name').select()
|
||||
|
||||
if sName.find('php-') != -1:
|
||||
tmp = sName.split('-')
|
||||
sName = tmp[0]
|
||||
version = tmp[1]
|
||||
isTask = '1'
|
||||
for task in self.__tasks:
|
||||
tmpt = public.getStrBetween('[', ']', task['name'])
|
||||
@@ -289,12 +328,10 @@ class plugins_api:
|
||||
continue
|
||||
tmp1 = tmpt.split('-')
|
||||
name1 = tmp1[0].lower()
|
||||
if sName == 'php':
|
||||
if name1 == sName and tmp1[1] == version:
|
||||
if sCoexist:
|
||||
if name1 == sName and tmp1[1] == sVer:
|
||||
isTask = task['status']
|
||||
else:
|
||||
if name1 == 'pure':
|
||||
name1 = 'pure-ftpd'
|
||||
if name1 == sName:
|
||||
isTask = task['status']
|
||||
return isTask
|
||||
@@ -410,7 +447,7 @@ class plugins_api:
|
||||
if info.has_key('coexist') and info['coexist']:
|
||||
coexist = True
|
||||
|
||||
pluginInfo = {
|
||||
pInfo = {
|
||||
"id": 10000,
|
||||
"pid": info['pid'],
|
||||
"type": 1000,
|
||||
@@ -431,29 +468,28 @@ class plugins_api:
|
||||
"status": False,
|
||||
}
|
||||
|
||||
pluginInfo['task'] = self.checkSetupTask(pluginInfo['name'])
|
||||
|
||||
if checks.find('VERSION') > -1:
|
||||
pluginInfo['install_checks'] = checks.replace(
|
||||
pInfo['install_checks'] = checks.replace(
|
||||
'VERSION', info['versions'])
|
||||
|
||||
if path.find('VERSION') > -1:
|
||||
pluginInfo['path'] = path.replace(
|
||||
pInfo['path'] = path.replace(
|
||||
'VERSION', info['versions'])
|
||||
|
||||
pluginInfo['display'] = self.checkDisplayIndex(
|
||||
info['name'], pluginInfo['versions'])
|
||||
pInfo['task'] = self.checkSetupTask(
|
||||
pInfo['name'], info['versions'], coexist)
|
||||
pInfo['display'] = self.checkDisplayIndex(
|
||||
info['name'], pInfo['versions'])
|
||||
|
||||
pluginInfo['setup'] = os.path.exists(pluginInfo['install_checks'])
|
||||
pInfo['setup'] = os.path.exists(pInfo['install_checks'])
|
||||
|
||||
if coexist and pluginInfo['setup']:
|
||||
pluginInfo['setup_version'] = info['versions']
|
||||
if coexist and pInfo['setup']:
|
||||
pInfo['setup_version'] = info['versions']
|
||||
else:
|
||||
pluginInfo['setup_version'] = self.getVersion(
|
||||
pluginInfo['install_checks'])
|
||||
pInfo['setup_version'] = self.getVersion(pInfo['install_checks'])
|
||||
# pluginInfo['status'] = self.checkStatus(pluginInfo)
|
||||
pluginInfo['status'] = False
|
||||
return pluginInfo
|
||||
pInfo['status'] = False
|
||||
return pInfo
|
||||
|
||||
def makeCoexist(self, data):
|
||||
plugins_info = []
|
||||
@@ -738,6 +774,7 @@ class plugins_api:
|
||||
public.writeFile(self.__index, json.dumps(indexList))
|
||||
return public.returnJson(True, '删除成功!')
|
||||
|
||||
# shell 调用
|
||||
def run(self, name, func, version, args='', script='index'):
|
||||
path = public.getRunDir() + '/' + self.__plugin_dir + \
|
||||
'/' + name + '/' + script + '.py'
|
||||
@@ -754,6 +791,20 @@ class plugins_api:
|
||||
# data = os.popen(py_cmd).read()
|
||||
|
||||
if public.isAppleSystem():
|
||||
print py_cmd
|
||||
print 'run', py_cmd
|
||||
# print os.path.exists(py_cmd)
|
||||
return (data[0].strip(), data[1].strip())
|
||||
|
||||
# 映射包调用
|
||||
def callback(self, name, func, args='', script='index'):
|
||||
package = public.getRunDir() + '/plugins/' + name
|
||||
if not os.path.exists(package):
|
||||
return (False, "插件不存在!")
|
||||
|
||||
sys.path.append(package)
|
||||
eval_str = "__import__('" + script + "')." + func + '(' + args + ')'
|
||||
newRet = eval(eval_str)
|
||||
if public.isAppleSystem():
|
||||
print 'callback', eval_str
|
||||
|
||||
return (True, newRet)
|
||||
|
||||
@@ -355,13 +355,16 @@ def HttpGet(url, timeout=10):
|
||||
|
||||
|
||||
def HttpGet2(url, timeout):
|
||||
import urllib
|
||||
import urllib2
|
||||
|
||||
req = urllib2.Request(url)
|
||||
res = urllib2.urlopen(req, timeout=timeout)
|
||||
result = res.read()
|
||||
return result
|
||||
try:
|
||||
req = urllib2.Request(url)
|
||||
res = urllib2.urlopen(req, timeout=timeout)
|
||||
result = res.read()
|
||||
return result
|
||||
|
||||
except Exception as e:
|
||||
return str(e)
|
||||
|
||||
|
||||
def httpGet(url, timeout=10):
|
||||
@@ -426,7 +429,7 @@ def writeSpeed(title, used, total, speed=0):
|
||||
|
||||
def getSpeed():
|
||||
# 取进度
|
||||
path = public.getRootDir()
|
||||
path = getRootDir()
|
||||
data = readFile(path + '/tmp/panelSpeed.pl')
|
||||
if not data:
|
||||
data = json.dumps({'title': None, 'progress': 0,
|
||||
|
||||
@@ -9,6 +9,8 @@ import json
|
||||
import pwd
|
||||
import shutil
|
||||
sys.path.append("/usr/local/lib/python2.7/site-packages")
|
||||
sys.path.append("/usr/lib64/python2.7/site-packages")
|
||||
|
||||
import psutil
|
||||
|
||||
from flask import request
|
||||
@@ -51,9 +53,15 @@ class site_api:
|
||||
def listApi(self):
|
||||
limit = request.form.get('limit', '').encode('utf-8')
|
||||
p = request.form.get('p', '').encode('utf-8')
|
||||
type_id = request.form.get('type_id', '').encode('utf-8')
|
||||
|
||||
start = (int(p) - 1) * (int(limit))
|
||||
_list = public.M('sites').where('', ()).field('id,name,path,status,ps,addtime,edate').limit(
|
||||
|
||||
siteM = public.M('sites')
|
||||
if type_id != '' and type_id == '-1' and type_id == '0':
|
||||
siteM.where('type_id=?', (type_id))
|
||||
|
||||
_list = siteM.field('id,name,path,status,ps,addtime,edate').limit(
|
||||
(str(start)) + ',' + limit).order('id desc').select()
|
||||
|
||||
for i in range(len(_list)):
|
||||
@@ -63,7 +71,7 @@ class site_api:
|
||||
_ret = {}
|
||||
_ret['data'] = _list
|
||||
|
||||
count = public.M('sites').where('', ()).count()
|
||||
count = siteM.count()
|
||||
_page = {}
|
||||
_page['count'] = count
|
||||
_page['tojs'] = 'getWeb'
|
||||
@@ -403,9 +411,9 @@ class site_api:
|
||||
'rm -rf /etc/letsencrypt/archive/' + siteName + '-00*')
|
||||
public.execShell(
|
||||
'rm -f /etc/letsencrypt/renewal/' + siteName + '.conf')
|
||||
public.execShell('rm -f /etc/letsencrypt/renewal/' +
|
||||
public.execShell('rm -rf /etc/letsencrypt/renewal/' +
|
||||
siteName + '-00*.conf')
|
||||
public.execShell('rm -f ' + path + '/README')
|
||||
public.execShell('rm -rf ' + path + '/README')
|
||||
public.execShell('mkdir -p ' + path)
|
||||
|
||||
public.writeFile(keypath, key)
|
||||
@@ -424,9 +432,38 @@ class site_api:
|
||||
return public.returnJson(False, 'ERROR: <br><a style="color:red;">' + isError.replace("\n", '<br>') + '</a>')
|
||||
|
||||
public.restartWeb()
|
||||
public.writeLog('TYPE_SITE', '证书已保存!')
|
||||
public.writeLog('网站管理', '证书已保存!')
|
||||
return public.returnJson(True, '证书已保存!')
|
||||
|
||||
def setCertToSiteApi(self):
|
||||
certName = request.form.get('certName', '').encode('utf-8')
|
||||
siteName = request.form.get('siteName', '').encode('utf-8')
|
||||
try:
|
||||
path = self.sslDir + siteName
|
||||
if not os.path.exists(path):
|
||||
return public.returnJson(False, '证书不存在!')
|
||||
|
||||
result = self.setSslConf(siteName)
|
||||
if not result['status']:
|
||||
return public.getJson(result)
|
||||
|
||||
public.restartWeb()
|
||||
public.writeLog('网站管理', '证书已部署!')
|
||||
return public.returnJson(True, '证书已部署!')
|
||||
except Exception as ex:
|
||||
return public.returnJson(False, '设置错误,' + str(ex))
|
||||
|
||||
def removeCertApi(self):
|
||||
certName = request.form.get('certName', '').encode('utf-8')
|
||||
try:
|
||||
path = self.sslDir + certName
|
||||
if not os.path.exists(path):
|
||||
return public.returnJson(False, '证书已不存在!')
|
||||
os.system("rm -rf " + path)
|
||||
return public.returnJson(True, '证书已删除!')
|
||||
except:
|
||||
return public.returnJson(False, '删除失败!')
|
||||
|
||||
def closeSslConfApi(self):
|
||||
siteName = request.form.get('siteName', '').encode('utf-8')
|
||||
|
||||
@@ -471,7 +508,7 @@ class site_api:
|
||||
public.writeFile(file, conf)
|
||||
|
||||
msg = public.getInfo('网站[{1}]关闭SSL成功!', (siteName,))
|
||||
public.writeLog('TYPE_SITE', msg)
|
||||
public.writeLog('网站管理', msg)
|
||||
public.restartWeb()
|
||||
return public.returnJson(True, 'SSL已关闭!')
|
||||
|
||||
@@ -498,7 +535,7 @@ class site_api:
|
||||
if siteConf.find('301-START') != -1:
|
||||
return public.returnJson(False, '检测到您的站点做了301重定向设置,请先关闭重定向!')
|
||||
|
||||
letpath = public.getServerDir() + '/letsencrypt/live/' + siteName
|
||||
letpath = self.sslDir + siteName
|
||||
csrpath = letpath + "/fullchain.pem" # 生成证书路径
|
||||
keypath = letpath + "/privkey.pem" # 密钥文件路径
|
||||
|
||||
@@ -556,8 +593,7 @@ class site_api:
|
||||
if domainCount == 0:
|
||||
return public.returnJson(False, '请选择域名(不包括IP地址与泛域名)!')
|
||||
|
||||
home_path = public.getServerDir() + '/openresty/nginx/conf/cert/' + \
|
||||
domains[0]
|
||||
home_path = '/root/.acme.sh/' + domains[0]
|
||||
home_cert = home_path + '/fullchain.cer'
|
||||
home_key = home_path + '/' + domains[0] + '.key'
|
||||
|
||||
@@ -566,11 +602,6 @@ class site_api:
|
||||
home_cert = home_path + '/fullchain.cer'
|
||||
home_key = home_path + '/' + domains[0] + '.key'
|
||||
|
||||
if not os.path.exists(home_cert):
|
||||
home_path = '/root/.acme.sh/' + domains[0]
|
||||
home_cert = home_path + '/fullchain.cer'
|
||||
home_key = home_path + '/' + domains[0] + '.key'
|
||||
|
||||
if public.isAppleSystem():
|
||||
user = public.execShell(
|
||||
"who | sed -n '2, 1p' |awk '{print $1}'")[0].strip()
|
||||
@@ -582,6 +613,8 @@ class site_api:
|
||||
|
||||
# print home_cert
|
||||
cmd = 'export ACCOUNT_EMAIL=' + email + ' && ' + execStr
|
||||
print domains
|
||||
print cmd
|
||||
result = public.execShell(cmd)
|
||||
|
||||
if not os.path.exists(home_cert.replace("\*", "*")):
|
||||
@@ -616,7 +649,6 @@ class site_api:
|
||||
|
||||
# 写入配置文件
|
||||
result = self.setSslConf(siteName)
|
||||
# print result['msg']
|
||||
if not result['status']:
|
||||
return public.getJson(result)
|
||||
result['csr'] = public.readFile(csrpath)
|
||||
@@ -625,6 +657,39 @@ class site_api:
|
||||
|
||||
return public.returnJson(True, 'OK', result)
|
||||
|
||||
def httpToHttpsApi(self):
|
||||
siteName = request.form.get('siteName', '').encode('utf-8')
|
||||
file = self.getHostConf(siteName)
|
||||
conf = public.readFile(file)
|
||||
if conf:
|
||||
# if conf.find('ssl_certificate') == -1:
|
||||
# return public.returnJson(False, '当前未开启SSL')
|
||||
to = """#error_page 404/404.html;
|
||||
#HTTP_TO_HTTPS_START
|
||||
if ($server_port !~ 443){
|
||||
rewrite ^(/.*)$ https://$host$1 permanent;
|
||||
}
|
||||
#HTTP_TO_HTTPS_END"""
|
||||
conf = conf.replace('#error_page 404/404.html;', to)
|
||||
public.writeFile(file, conf)
|
||||
|
||||
public.restartWeb()
|
||||
return public.returnJson(True, '设置成功!证书也要设置好哟!')
|
||||
|
||||
def closeToHttpsApi(self):
|
||||
siteName = request.form.get('siteName', '').encode('utf-8')
|
||||
file = self.getHostConf(siteName)
|
||||
conf = public.readFile(file)
|
||||
if conf:
|
||||
rep = "\n\s*#HTTP_TO_HTTPS_START(.|\n){1,300}#HTTP_TO_HTTPS_END"
|
||||
conf = re.sub(rep, '', conf)
|
||||
rep = "\s+if.+server_port.+\n.+\n\s+\s*}"
|
||||
conf = re.sub(rep, '', conf)
|
||||
public.writeFile(file, conf)
|
||||
|
||||
public.restartWeb()
|
||||
return public.returnJson(True, '关闭HTTPS跳转成功!')
|
||||
|
||||
def getIndexApi(self):
|
||||
sid = request.form.get('id', '').encode('utf-8')
|
||||
data = {}
|
||||
@@ -757,7 +822,7 @@ class site_api:
|
||||
|
||||
public.restartWeb()
|
||||
msg = public.getInfo('网站[{1}]添加域名[{2}]成功!', (webname, domain_name))
|
||||
public.writeLog('TYPE_SITE', msg)
|
||||
public.writeLog('网站管理', msg)
|
||||
public.M('domain').add('pid,name,port,addtime',
|
||||
(pid, domain_name, domain_port, public.getDate()))
|
||||
|
||||
@@ -1056,7 +1121,7 @@ class site_api:
|
||||
|
||||
public.M('domain').where("id=?", (find['id'],)).delete()
|
||||
msg = public.getInfo('网站[{1}]删除域名[{2}]成功!', (webname, domain))
|
||||
public.writeLog('TYPE_SITE', msg)
|
||||
public.writeLog('网站管理', msg)
|
||||
public.restartWeb()
|
||||
return public.returnJson(True, '站点删除成功!')
|
||||
|
||||
@@ -1107,9 +1172,58 @@ class site_api:
|
||||
proxylist.append(i)
|
||||
return public.getJson(proxylist)
|
||||
|
||||
def getSiteTypesApi(self):
|
||||
# 取网站分类
|
||||
data = public.M("site_types").field("id,name").order("id asc").select()
|
||||
data.insert(0, {"id": 0, "name": "默认分类"})
|
||||
return public.getJson(data)
|
||||
|
||||
def addSiteTypeApi(self):
|
||||
name = request.form.get('name', '').strip().encode('utf-8')
|
||||
if not name:
|
||||
return public.returnJson(False, "分类名称不能为空")
|
||||
if len(name) > 18:
|
||||
return public.returnJson(False, "分类名称长度不能超过6个汉字或18位字母")
|
||||
if public.M('site_types').count() >= 10:
|
||||
return public.returnJson(False, '最多添加10个分类!')
|
||||
if public.M('site_types').where('name=?', (name,)).count() > 0:
|
||||
return public.returnJson(False, "指定分类名称已存在!")
|
||||
public.M('site_types').add("name", (name,))
|
||||
return public.returnJson(True, '添加成功!')
|
||||
|
||||
def removeSiteTypeApi(self):
|
||||
mid = request.form.get('id', '').encode('utf-8')
|
||||
if public.M('site_types').where('id=?', (mid,)).count() == 0:
|
||||
return public.returnJson(False, "指定分类不存在!")
|
||||
public.M('site_types').where('id=?', (mid,)).delete()
|
||||
public.M("sites").where("type_id=?", (mid,)).save("type_id", (0,))
|
||||
return public.returnJson(True, "分类已删除!")
|
||||
|
||||
def modifySiteTypeNameApi(self):
|
||||
# 修改网站分类名称
|
||||
name = request.form.get('name', '').strip().encode('utf-8')
|
||||
mid = request.form.get('id', '').encode('utf-8')
|
||||
if not name:
|
||||
return public.returnJson(False, "分类名称不能为空")
|
||||
if len(name) > 18:
|
||||
return public.returnJson(False, "分类名称长度不能超过6个汉字或18位字母")
|
||||
if public.M('site_types').where('id=?', (mid,)).count() == 0:
|
||||
return public.returnJson(False, "指定分类不存在!")
|
||||
public.M('site_types').where('id=?', (mid,)).setField('name', name)
|
||||
return public.returnJson(True, "修改成功!")
|
||||
|
||||
def setSiteTypeApi(self):
|
||||
# 设置指定站点的分类
|
||||
site_ids = request.form.get('site_ids', '').encode('utf-8')
|
||||
mid = request.form.get('id', '').encode('utf-8')
|
||||
site_ids = json.loads(site_ids)
|
||||
for sid in site_ids:
|
||||
print public.M('sites').where('id=?', (sid,)).setField('type_id', mid)
|
||||
return public.returnJson(True, "设置成功!")
|
||||
|
||||
##### ----- end ----- ###
|
||||
|
||||
# 域名编码转换
|
||||
# 域名编码转换
|
||||
def toPunycode(self, domain):
|
||||
import re
|
||||
if sys.version_info[0] == 2:
|
||||
@@ -1514,13 +1628,12 @@ location /{
|
||||
self.sitePort = port.strip().replace(' ', '')
|
||||
self.phpVersion = version
|
||||
|
||||
siteM = public.M('sites')
|
||||
if siteM.where("name=?", (self.siteName,)).count():
|
||||
if public.M('sites').where("name=?", (self.siteName,)).count():
|
||||
return public.returnJson(False, '您添加的站点已存在!')
|
||||
|
||||
# 写入数据库
|
||||
pid = siteM.add('name,path,status,ps,edate,addtime',
|
||||
(self.siteName, self.sitePath, '1', ps, '0000-00-00', public.getDate()))
|
||||
pid = public.M('sites').add('name,path,status,ps,edate,addtime,type_id',
|
||||
(self.siteName, self.sitePath, '1', ps, '0000-00-00', public.getDate(), 0,))
|
||||
opid = public.M('domain').where(
|
||||
"name=?", (self.siteName,)).getField('pid')
|
||||
if opid:
|
||||
@@ -1532,14 +1645,13 @@ location /{
|
||||
for domain in siteMenu['domainlist']:
|
||||
sdomain = domain
|
||||
swebname = self.siteName
|
||||
spid = str(get.pid)
|
||||
spid = str(pid)
|
||||
# self.addDomain(domain, webname, pid)
|
||||
|
||||
public.M('domain').add('pid,name,port,addtime',
|
||||
(pid, self.siteName, self.sitePort, public.getDate()))
|
||||
|
||||
self.createRootDir(self.sitePath)
|
||||
|
||||
self.nginxAddConf()
|
||||
|
||||
data = {}
|
||||
@@ -1550,16 +1662,22 @@ location /{
|
||||
def deleteWSLogs(self, webname):
|
||||
assLogPath = public.getLogsDir() + '/' + webname + '.log'
|
||||
errLogPath = public.getLogsDir() + '/' + webname + '.error.log'
|
||||
confFile = self.setupPath + '/openresty/nginx/conf/vhost/' + webname + '.conf'
|
||||
rewriteFile = self.setupPath + '/openresty/nginx/conf/rewrite/' + webname + '.conf'
|
||||
logs = [assLogPath, errLogPath, confFile, rewriteFile]
|
||||
confFile = self.setupPath + '/nginx/vhost/' + webname + '.conf'
|
||||
rewriteFile = self.setupPath + '/nginx/rewrite/' + webname + '.conf'
|
||||
rewriteFile = self.setupPath + '/nginx/pass/' + webname + '.conf'
|
||||
keyPath = self.sslDir + webname + '/privkey.pem'
|
||||
certPath = self.sslDir + webname + '/fullchain.pem'
|
||||
logs = [assLogPath,
|
||||
errLogPath,
|
||||
confFile,
|
||||
rewriteFile,
|
||||
keyPath,
|
||||
certPath]
|
||||
for i in logs:
|
||||
public.deleteFile(i)
|
||||
|
||||
def delete(self, sid, webname, path):
|
||||
|
||||
self.deleteWSLogs(webname)
|
||||
|
||||
if path == '1':
|
||||
rootPath = public.getWwwDir() + '/' + webname
|
||||
public.execShell('rm -rf ' + rootPath)
|
||||
@@ -1617,7 +1735,7 @@ location /{
|
||||
self.saveCert(keyPath, certPath)
|
||||
|
||||
msg = public.getInfo('网站[{1}]开启SSL成功!', siteName)
|
||||
public.writeLog('TYPE_SITE', msg)
|
||||
public.writeLog('网站管理', msg)
|
||||
return public.returnData(True, 'SSL开启成功!')
|
||||
|
||||
def saveCert(self, keyPath, certPath):
|
||||
|
||||
@@ -601,20 +601,24 @@ class system_api:
|
||||
return 'test'
|
||||
|
||||
old_list = old.split('.')
|
||||
|
||||
ret = 'none'
|
||||
for i in range(len(old_list)):
|
||||
tm_new = int(new_list[i])
|
||||
tm_old = int(new_list[i])
|
||||
if tm_new > tm_old:
|
||||
return 'new'
|
||||
|
||||
# t = [0] * 3
|
||||
isHasNew = True
|
||||
for i in range(3):
|
||||
if int(new_list[i]) > int(old_list[i]):
|
||||
pass
|
||||
else:
|
||||
isHasNew = False
|
||||
|
||||
if isHasNew:
|
||||
return 'new'
|
||||
return ret
|
||||
|
||||
def getServerInfo(self):
|
||||
upAddr = 'https://raw.githubusercontent.com/midoks/mdserver-web/master/version/info.json'
|
||||
try:
|
||||
version = public.httpGet(upAddr)
|
||||
print version
|
||||
version = json.loads(version)
|
||||
return version[0]
|
||||
except Exception as e:
|
||||
@@ -635,6 +639,7 @@ class system_api:
|
||||
|
||||
diff = self.versionDiff(
|
||||
version_now, version_new_info['version'])
|
||||
print diff
|
||||
if diff == 'new':
|
||||
return public.returnJson(True, '有新版本!', version_new_info['version'])
|
||||
elif diff == 'test':
|
||||
|
||||
@@ -15,12 +15,15 @@ mw_start_debug(){
|
||||
gunicorn -b :7200 -k gevent -w 1 app:app
|
||||
# gunicorn -b :7200 -k eventlet -w 1 app:app
|
||||
# gunicorn -c setting.py app:app
|
||||
|
||||
}
|
||||
|
||||
mw_stop()
|
||||
{
|
||||
ps -ef|grep app:app |grep -v grep|awk '{print $2}'|xargs kill -9
|
||||
PLIST=`ps -ef|grep app:app |grep -v grep|awk '{print $2}'`
|
||||
for i in $PLIST
|
||||
do
|
||||
kill -9 $i
|
||||
done
|
||||
ps -ef|grep task.py |grep -v grep|awk '{print $2}'|xargs kill -9
|
||||
}
|
||||
|
||||
|
||||
@@ -65,11 +65,17 @@ CREATE TABLE IF NOT EXISTS `sites` (
|
||||
`path` TEXT,
|
||||
`status` TEXT,
|
||||
`index` TEXT,
|
||||
`type_id` INTEGER,
|
||||
`ps` TEXT,
|
||||
`edate` TEXT,
|
||||
`addtime` TEXT
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `site_types` (
|
||||
`id` INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
`name` TEXT
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `domain` (
|
||||
`id` INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
`pid` INTEGER,
|
||||
|
||||
|
Before Width: | Height: | Size: 181 B |
@@ -1,16 +0,0 @@
|
||||
<div class="bt-form">
|
||||
<div class="bt-w-main">
|
||||
<div class="bt-w-menu">
|
||||
<p class="bgw" onclick="pluginService('abkill');">服务</p>
|
||||
<p onclick="pluginInitD('abkill');">自启动</p>
|
||||
<p onclick="pluginConfig('abkill');">黑名单</p>
|
||||
<p onclick="pluginConfig('abkill');">异常日志</p>
|
||||
</div>
|
||||
<div class="bt-w-con pd15">
|
||||
<div class="soft-man-con"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
$.getScript( "/plugins/file?name=abkill&f=js/abkill.js");
|
||||
</script>
|
||||
@@ -1,172 +0,0 @@
|
||||
# coding: utf-8
|
||||
|
||||
import time
|
||||
import random
|
||||
import os
|
||||
import urllib
|
||||
import binascii
|
||||
import json
|
||||
import re
|
||||
import sys
|
||||
import subprocess
|
||||
|
||||
sys.path.append(os.getcwd() + "/class/core")
|
||||
import public
|
||||
|
||||
|
||||
app_debug = False
|
||||
if public.getOs() == 'darwin':
|
||||
app_debug = True
|
||||
|
||||
|
||||
def getPluginName():
|
||||
return 'abkill'
|
||||
|
||||
|
||||
def getPluginDir():
|
||||
return public.getPluginDir() + '/' + getPluginName()
|
||||
|
||||
|
||||
def getServerDir():
|
||||
return public.getServerDir() + '/' + getPluginName()
|
||||
|
||||
|
||||
def getInitDFile():
|
||||
if app_debug:
|
||||
return '/tmp/' + getPluginName()
|
||||
return '/etc/init.d/' + getPluginName()
|
||||
|
||||
|
||||
def getArgs():
|
||||
args = sys.argv[2:]
|
||||
tmp = {}
|
||||
args_len = len(args)
|
||||
|
||||
if args_len == 1:
|
||||
t = args[0].strip('{').strip('}')
|
||||
t = t.split(':')
|
||||
tmp[t[0]] = t[1]
|
||||
elif args_len > 1:
|
||||
for i in range(len(args)):
|
||||
t = args[i].split(':')
|
||||
tmp[t[0]] = t[1]
|
||||
|
||||
return tmp
|
||||
|
||||
|
||||
def initDreplace():
|
||||
initd_file = getInitDFile()
|
||||
|
||||
if not os.path.exists(initd_file):
|
||||
return getServerDir()
|
||||
|
||||
return initd_file
|
||||
|
||||
|
||||
def status():
|
||||
data = public.execShell(
|
||||
"ps -ef|grep " + getPluginName() + " |grep -v grep | grep -v python | awk '{print $2}'")
|
||||
if data[0] == '':
|
||||
return 'stop'
|
||||
return 'start'
|
||||
|
||||
|
||||
def csvnOp(method):
|
||||
|
||||
if app_debug:
|
||||
os_name = public.getOs()
|
||||
if os_name == 'darwin':
|
||||
return "Apple Computer does not support"
|
||||
|
||||
_initd_csvn = '/etc/init.d/csvn'
|
||||
_initd_csvn_httpd = '/etc/init.d/csvn-httpd'
|
||||
#_csvn = getServerDir() + '/bin/csvn'
|
||||
#_csvn_httpd = getServerDir() + '/bin/csvn-httpd'
|
||||
|
||||
ret_csvn_httpd = public.execShell(_initd_csvn_httpd + ' ' + method)
|
||||
# ret_csvn = public.execShell(_initd_csvn + ' ' + method)
|
||||
subprocess.Popen(_initd_csvn + ' ' + method,
|
||||
stdout=subprocess.PIPE, shell=True)
|
||||
if ret_csvn_httpd[1] == '':
|
||||
return 'ok'
|
||||
return 'fail'
|
||||
|
||||
|
||||
def start():
|
||||
return csvnOp('start')
|
||||
|
||||
|
||||
def stop():
|
||||
return csvnOp('stop')
|
||||
|
||||
|
||||
def restart():
|
||||
return csvnOp('restart')
|
||||
|
||||
|
||||
def reload():
|
||||
return csvnOp('reload')
|
||||
|
||||
|
||||
def initdStatus():
|
||||
if not app_debug:
|
||||
if public.getOs() == 'darwin':
|
||||
return "Apple Computer does not support"
|
||||
|
||||
_initd_csvn = '/etc/init.d/csvn'
|
||||
_initd_csvn_httpd = '/etc/init.d/csvn-httpd'
|
||||
|
||||
if os.path.exists(_initd_csvn) and os.path.exists(_initd_csvn_httpd):
|
||||
return 'ok'
|
||||
return 'fail'
|
||||
|
||||
|
||||
def initdInstall():
|
||||
import shutil
|
||||
if not app_debug:
|
||||
if public.getOs() == 'darwin':
|
||||
return "Apple Computer does not support"
|
||||
|
||||
_csvn = getServerDir() + '/bin/csvn'
|
||||
_csvn_httpd = getServerDir() + '/bin/csvn-httpd'
|
||||
|
||||
ret_csvn = public.execShell(_csvn + ' install')
|
||||
ret_csvn_httpd = public.execShell(_csvn_httpd + ' install')
|
||||
if ret_csvn[1] == '' and ret_csvn_httpd[1] == '':
|
||||
return 'ok'
|
||||
return 'fail'
|
||||
|
||||
|
||||
def initdUinstall():
|
||||
if not app_debug:
|
||||
if public.getOs() == 'darwin':
|
||||
return "Apple Computer does not support"
|
||||
|
||||
_csvn = getServerDir() + '/bin/csvn'
|
||||
_csvn_httpd = getServerDir() + '/bin/csvn-httpd'
|
||||
|
||||
ret_csvn = public.execShell(_csvn + ' remove')
|
||||
ret_csvn_httpd = public.execShell(_csvn_httpd + ' remove')
|
||||
return 'ok'
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
func = sys.argv[1]
|
||||
if func == 'status':
|
||||
print status()
|
||||
elif func == 'start':
|
||||
print start()
|
||||
elif func == 'stop':
|
||||
print stop()
|
||||
elif func == 'restart':
|
||||
print restart()
|
||||
elif func == 'reload':
|
||||
print reload()
|
||||
elif func == 'initd_status':
|
||||
print initdStatus()
|
||||
elif func == 'initd_install':
|
||||
print initdInstall()
|
||||
elif func == 'initd_uninstall':
|
||||
print initdUinstall()
|
||||
else:
|
||||
print 'fail'
|
||||
@@ -1,16 +0,0 @@
|
||||
{
|
||||
"sort": 7,
|
||||
"ps": "异常程序监控和KILL",
|
||||
"shell": "install.sh",
|
||||
"name": "abkill",
|
||||
"title": "异常程序监控",
|
||||
"versions": "0.1",
|
||||
"updates":"0.1",
|
||||
"tip": "soft",
|
||||
"checks": "server/abkill",
|
||||
"author": "midoks",
|
||||
"date": "201-04-01",
|
||||
"home": "https://www.collab.net",
|
||||
"type": "异常程序监控和KILL",
|
||||
"pid": "4"
|
||||
}
|
||||
@@ -1,76 +0,0 @@
|
||||
#!/bin/bash
|
||||
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
|
||||
|
||||
ak_path={$SERVER_PATH}/abkill
|
||||
|
||||
ak_start(){
|
||||
isStart=$(ps aux |grep 'abkill.py'|grep -v grep|awk '{print $2}')
|
||||
if [ "$isStart" == '' ];then
|
||||
echo -e "Starting abkill... \c"
|
||||
cd $ak_path && nohup python abkill.py >> $ak_path/task.log 2>&1 &
|
||||
sleep 0.3
|
||||
isStart=$(ps aux |grep 'abkill.py'|grep -v grep|awk '{print $2}')
|
||||
if [ "$isStart" == '' ];then
|
||||
echo -e "\033[31mfailed\033[0m"
|
||||
echo '------------------------------------------------------'
|
||||
tail -n 20 $ak_path/task.log
|
||||
echo '------------------------------------------------------'
|
||||
echo -e "\033[31mError: abkill service startup failed.\033[0m"
|
||||
return;
|
||||
fi
|
||||
echo -e "\033[32mdone\033[0m"
|
||||
else
|
||||
echo "Starting abkill(pid $isStart) already running"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
ak_stop()
|
||||
{
|
||||
echo -e "Stopping abkill... \c";
|
||||
pids=$(ps aux | grep 'abkill.py' | grep -v grep|awk '{print $2}')
|
||||
arr=($pids)
|
||||
|
||||
for p in ${arr[@]}
|
||||
do
|
||||
kill -9 $p
|
||||
done
|
||||
echo -e "\033[32mdone\033[0m"
|
||||
|
||||
}
|
||||
|
||||
ak_status()
|
||||
{
|
||||
isStart=$(ps aux|grep 'abkill.py'|grep -v grep|awk '{print $2}')
|
||||
if [ "$isStart" != '' ];then
|
||||
echo -e "\033[32mabkill (pid $(echo $isStart)) already running\033[0m"
|
||||
else
|
||||
echo -e "\033[31mabkill not running\033[0m"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
ak_reload()
|
||||
{
|
||||
isStart=$(ps aux|grep 'abkill.py'|grep -v grep|awk '{print $2}')
|
||||
|
||||
if [ "$isStart" != '' ];then
|
||||
ak_stop
|
||||
ak_start
|
||||
else
|
||||
echo -e "\033[31mmw not running\033[0m"
|
||||
mw_start
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
case "$1" in
|
||||
'start') ak_start;;
|
||||
'stop') ak_stop;;
|
||||
'reload') ak_reload;;
|
||||
'restart')
|
||||
ak_stop
|
||||
sleep 0.3
|
||||
ak_start;;
|
||||
'status') ak_status;;
|
||||
esac
|
||||
@@ -1 +0,0 @@
|
||||
pluginService('abkill');
|
||||
@@ -1,85 +0,0 @@
|
||||
# coding: utf-8
|
||||
|
||||
# 使用示例:
|
||||
# 1、将此文件重命名为btkill.py , 然后上传到服务器/root目录
|
||||
# 2、执行 python /root/btkill.py
|
||||
|
||||
import time
|
||||
import os
|
||||
import sys
|
||||
sys.path.append("/usr/local/lib/python2.7/site-packages")
|
||||
import psutil
|
||||
|
||||
|
||||
class btkill:
|
||||
__limit = 10 # Cpu使用率触发上限
|
||||
__vmsize = 1048576 / 4 # 虚拟内存触发上限(字节)
|
||||
|
||||
def checkMain(self):
|
||||
pids = psutil.pids()
|
||||
print pids
|
||||
num = 0
|
||||
for pid in pids:
|
||||
try:
|
||||
p = psutil.Process(pid)
|
||||
if p.exe() == "":
|
||||
continue
|
||||
name = p.name()
|
||||
if self.whiteList(name):
|
||||
continue
|
||||
cputimes = p.cpu_times()
|
||||
if cputimes.user < 0.1:
|
||||
continue
|
||||
print p
|
||||
percent = p.cpu_percent(interval=1)
|
||||
vm = p.memory_info().vms
|
||||
if percent > self.__limit or vm > self.__vmsize:
|
||||
log = time.strftime('%Y-%m-%d %X', time.localtime()) + " (PID=" + str(
|
||||
pid) + ", NAME=" + name + ", VMS=" + str(vm) + ", PERCENT=" + str(percent) + "%)"
|
||||
# p.kill()
|
||||
num += 1
|
||||
print log + " >> killed\n"
|
||||
except Exception as ex:
|
||||
print str(ex)
|
||||
return num
|
||||
|
||||
# 检查白名单
|
||||
def whiteList(self, name):
|
||||
wlist = ['yum', 'apt-get', 'apt', 'redis-cli', 'memcached', 'sshd', 'vm', 'vim', 'htop', 'top', 'sh', 'bash', 'zip', 'gzip', 'rsync',
|
||||
'tar', 'unzip', 'php', 'composer', 'pkill', 'mongo', 'mongod', 'php-fpm', 'nginx', 'httpd', 'lsof', 'ps', 'redis-server',
|
||||
'mysqld', 'mysqld_safe', 'mysql', 'pure-ftpd', 'sparse_dd', 'stunnel', 'squeezed', 'vncterm', 'awk', 'ruby', 'postgres',
|
||||
'mpathalert', 'vncterm', 'multipathd', 'fe', 'elasticsyslog', 'syslogd', 'v6d', 'xapi', 'screen', 'runsvdir', 'svlogd',
|
||||
'java', 'udevd', 'ntpd', 'irqbalance', 'qmgr', 'wpa_supplicant', 'mysqld_safe', 'sftp-server', 'lvmetad', 'gitlab-web',
|
||||
'pure-ftpd', 'auditd', 'master', 'dbus-daemon', 'tapdisk', 'sshd', 'init', 'ksoftirqd', 'kworker', 'kmpathd',
|
||||
'kmpath_handlerd', 'python', 'kdmflush', 'bioset', 'crond', 'kthreadd', 'migration', 'rcu_sched', 'kjournald',
|
||||
'gcc', 'gcc++', 'nginx', 'mysqld', 'php-cgi', 'login', 'firewalld', 'iptables', 'systemd', 'network', 'dhclient',
|
||||
'systemd-journald', 'NetworkManager', 'systemd-logind', 'systemd-udevd', 'polkitd', 'tuned', 'rsyslogd', 'AliYunDunUpdate', 'AliYunDun', 'sendmail']
|
||||
wslist = ['vif', 'qemu', 'scsi_eh', 'xcp',
|
||||
'xen', 'docker', 'yunsuo', 'aliyun', 'PM2']
|
||||
|
||||
for key in wlist:
|
||||
if key == name:
|
||||
return True
|
||||
|
||||
for key in wslist:
|
||||
if name.find(key) != -1:
|
||||
return True
|
||||
|
||||
return False
|
||||
|
||||
# 开始处理
|
||||
def start(self):
|
||||
num = 0
|
||||
while True:
|
||||
num += self.checkMain()
|
||||
print "查杀完成, 共查杀[" + str(num) + "]个异常进程!"
|
||||
time.sleep(3)
|
||||
print '======================================='
|
||||
print "查杀完成, 共查杀[" + str(num) + "]个异常进程!"
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
print "正在检测异常进程..."
|
||||
print '======================================='
|
||||
c = btkill()
|
||||
c.start()
|
||||
|
After Width: | Height: | Size: 498 B |
@@ -0,0 +1,9 @@
|
||||
<script type="text/javascript">
|
||||
resetPluginWinWidth(480);
|
||||
// $.getScript( "/plugins/file?name=webssh&f=js/webssh.js", function() {
|
||||
//});
|
||||
if ($(".term-box #term").text() != 'W') {
|
||||
layer.closeAll();
|
||||
webShell();
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,20 @@
|
||||
# coding: utf-8
|
||||
|
||||
import time
|
||||
import random
|
||||
import os
|
||||
import json
|
||||
import re
|
||||
import sys
|
||||
|
||||
sys.path.append(os.getcwd() + "/class/core")
|
||||
import public
|
||||
|
||||
|
||||
def status():
|
||||
return 'start'
|
||||
|
||||
if __name__ == "__main__":
|
||||
func = sys.argv[1]
|
||||
if func == 'status':
|
||||
print status()
|
||||
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"id":4,
|
||||
"title":"BBR[DEV]",
|
||||
"tip":"soft",
|
||||
"name":"bbr",
|
||||
"type":"软件",
|
||||
"ps":"BBR是Google提出的一种新型拥塞控制算法,可以使Linux服务器显著地提高吞吐量和减少TCP连接的延迟",
|
||||
"versions":"1.0",
|
||||
"shell":"install.sh",
|
||||
"checks":"server/bbr",
|
||||
"author":"Google",
|
||||
"home":"https://github.com/google/bbr",
|
||||
"date":"2019-03-29",
|
||||
"pid":"4"
|
||||
}
|
||||
@@ -2,31 +2,33 @@
|
||||
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
|
||||
export PATH
|
||||
|
||||
|
||||
curPath=`pwd`
|
||||
rootPath=$(dirname "$curPath")
|
||||
rootPath=$(dirname "$rootPath")
|
||||
serverPath=$(dirname "$rootPath")
|
||||
|
||||
install_tmp=${rootPath}/tmp/mw_install.pl
|
||||
|
||||
install_tmp=${rootPath}/tmp/bt_install.pl
|
||||
|
||||
Install_abkill()
|
||||
Install_bbr()
|
||||
{
|
||||
echo '正在安装脚本文件...' > $install_tmp
|
||||
mkdir -p $serverPath/abkill
|
||||
echo '0.1' > $serverPath/abkill/version.pl
|
||||
|
||||
|
||||
mkdir -p $serverPath/bbr
|
||||
echo '1.0' > $serverPath/bbr/version.pl
|
||||
echo '安装完成' > $install_tmp
|
||||
}
|
||||
|
||||
Uninstall_abkill()
|
||||
Uninstall_bbr()
|
||||
{
|
||||
rm -f $serverPath/abkill
|
||||
rm -rf $serverPath/bbr
|
||||
echo "卸载完成" > $install_tmp
|
||||
}
|
||||
|
||||
action=$1
|
||||
if [ "${1}" == 'install' ];then
|
||||
Install_abkill
|
||||
Install_bbr
|
||||
else
|
||||
Uninstall_abkill
|
||||
Uninstall_bbr
|
||||
fi
|
||||
@@ -25,14 +25,17 @@ resetPluginWinWidth(700);
|
||||
$.getScript( "/plugins/file?name=csvn&f=js/csvn.js");
|
||||
|
||||
function csvnReadme(){
|
||||
var html = '<p>* 注意:在启动时会比较慢,需要耐心等待一会</p>';
|
||||
html += '<p>* 注意:csvn需要java环境,在安装会自动检查并安装</p>';
|
||||
html += '<p>* 注意:默认后台密码admin:admin,最好马上修改</p>';
|
||||
html += '<p>* 注意:牢记admin的密码,在后csvn的管理后台和这里不同步</p>';
|
||||
html += '<p>* 注意:在这里添加用户和csvn后台并不同步</p>';
|
||||
html += '<p>* 注意:项目管理的地址一般是正确的,但在特殊环境下,地址可能不一致</p>';
|
||||
html += '<p>* 注意:脚本内使用sudo名,需要注释(vi /etc/sudoers)[#Default requiretty]</p>';
|
||||
|
||||
$('.bt-w-main .soft-man-con').html(html);
|
||||
var readme = '<ul class="help-info-text c7">';
|
||||
readme += '<li>注意:在启动时会比较慢,需要耐心等待一会</li>';
|
||||
readme += '<li>注意:csvn需要java环境,在安装会自动检查并安装</li>';
|
||||
readme += '<li>注意:默认后台密码admin:admin,最好马上修改</li>';
|
||||
readme += '<li>注意:牢记admin的密码,在后csvn的管理后台和这里不同步</li>';
|
||||
readme += '<li>注意:在这里添加用户和csvn后台并不同步</li>';
|
||||
readme += '<li>注意:项目管理的地址一般是正确的,但在特殊环境下,地址可能不一致</li>';
|
||||
readme += '<li>注意:脚本内使用sudo名,需要注释(vi /etc/sudoers)[#Default requiretty]</li>';
|
||||
readme += '</ul>';
|
||||
|
||||
$('.bt-w-main .soft-man-con').html(readme);
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -7,7 +7,7 @@ rootPath=$(dirname "$curPath")
|
||||
rootPath=$(dirname "$rootPath")
|
||||
serverPath=$(dirname "$rootPath")
|
||||
|
||||
install_tmp=${rootPath}/tmp/bt_install.pl
|
||||
install_tmp=${rootPath}/tmp/mw_install.pl
|
||||
|
||||
|
||||
CSVN_SOURCE='https://github.com/midoks/mdserver-web/releases/download/init/CollabNetSubversionEdge-5.1.4_linux-x86_64.tar.xz'
|
||||
|
||||
@@ -7,7 +7,7 @@ rootPath=$(dirname "$curPath")
|
||||
rootPath=$(dirname "$rootPath")
|
||||
serverPath=$(dirname "$rootPath")
|
||||
|
||||
install_tmp=${rootPath}/tmp/bt_install.pl
|
||||
install_tmp=${rootPath}/tmp/mw_install.pl
|
||||
|
||||
Install_gae()
|
||||
{
|
||||
|
||||
@@ -35,9 +35,9 @@ USE_PLAIN_TEXT = true
|
||||
[service]
|
||||
REGISTER_EMAIL_CONFIRM = false
|
||||
ENABLE_NOTIFY_MAIL = false
|
||||
DISABLE_REGISTRATION = false
|
||||
DISABLE_REGISTRATION = true
|
||||
ENABLE_CAPTCHA = true
|
||||
REQUIRE_SIGNIN_VIEW = false
|
||||
REQUIRE_SIGNIN_VIEW = true
|
||||
|
||||
[picture]
|
||||
DISABLE_GRAVATAR = false
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
GITADDR="{$GITROOTURL}{$USERNAME}/{$PROJECT}"
|
||||
GITADDR="{$GITROOTURL}/{$USERNAME}/{$PROJECT}"
|
||||
GIT_SDIR="{$CODE_DIR}"
|
||||
|
||||
GIT_USER_DIR="${GIT_SDIR}/{$USERNAME}"
|
||||
|
||||
|
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
@@ -46,11 +46,11 @@ def getArgs():
|
||||
|
||||
if args_len == 1:
|
||||
t = args[0].strip('{').strip('}')
|
||||
t = t.split(':')
|
||||
t = t.split(':', 1)
|
||||
tmp[t[0]] = t[1]
|
||||
elif args_len > 1:
|
||||
for i in range(len(args)):
|
||||
t = args[i].split(':')
|
||||
t = args[i].split(':', 1)
|
||||
tmp[t[0]] = t[1]
|
||||
|
||||
return tmp
|
||||
@@ -84,19 +84,37 @@ def status():
|
||||
return 'start'
|
||||
|
||||
|
||||
def contentReplace(content):
|
||||
user = 'root'
|
||||
def getHomeDir():
|
||||
if public.isAppleSystem():
|
||||
user = public.execShell(
|
||||
"who | sed -n '2, 1p' |awk '{print $1}'")[0].strip()
|
||||
content = content.replace('{$HOME_DIR}', '/Users/' + user)
|
||||
return '/Users/' + user
|
||||
else:
|
||||
content = content.replace('{$HOME_DIR}', '/root')
|
||||
return '/root'
|
||||
|
||||
|
||||
def getRunUser():
|
||||
if public.isAppleSystem():
|
||||
user = public.execShell(
|
||||
"who | sed -n '2, 1p' |awk '{print $1}'")[0].strip()
|
||||
return user
|
||||
else:
|
||||
return 'root'
|
||||
|
||||
__SR = '''#!/bin/bash
|
||||
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
|
||||
export PATH
|
||||
export USER=%s
|
||||
export HOME=%s && ''' % ( getRunUser(), getHomeDir())
|
||||
|
||||
|
||||
def contentReplace(content):
|
||||
|
||||
service_path = public.getServerDir()
|
||||
content = content.replace('{$ROOT_PATH}', public.getRootDir())
|
||||
content = content.replace('{$SERVER_PATH}', service_path)
|
||||
content = content.replace('{$RUN_USER}', user)
|
||||
content = content.replace('{$RUN_USER}', getRunUser())
|
||||
content = content.replace('{$HOME_DIR}', getHomeDir())
|
||||
|
||||
return content
|
||||
|
||||
@@ -141,6 +159,15 @@ def getRootUrl():
|
||||
return tmp.groups()[0]
|
||||
|
||||
|
||||
def getSshPort():
|
||||
content = public.readFile(getConf())
|
||||
rep = 'SSH_PORT\s*=\s*(.*)'
|
||||
tmp = re.search(rep, content)
|
||||
if not tmp:
|
||||
return ''
|
||||
return tmp.groups()[0]
|
||||
|
||||
|
||||
def getRootPath():
|
||||
content = public.readFile(getConf())
|
||||
rep = 'ROOT\s*=\s*(.*)'
|
||||
@@ -221,7 +248,7 @@ def start():
|
||||
if not data['status']:
|
||||
return data['msg']
|
||||
|
||||
data = public.execShell(file + ' start')
|
||||
data = public.execShell(__SR + file + ' start')
|
||||
if data[1] == '':
|
||||
return 'ok'
|
||||
return data[0]
|
||||
@@ -229,7 +256,7 @@ def start():
|
||||
|
||||
def stop():
|
||||
file = initDreplace()
|
||||
data = public.execShell(file + ' stop')
|
||||
data = public.execShell(__SR + file + ' stop')
|
||||
if data[1] == '':
|
||||
return 'ok'
|
||||
return data[1]
|
||||
@@ -237,7 +264,7 @@ def stop():
|
||||
|
||||
def restart():
|
||||
file = initDreplace()
|
||||
data = public.execShell(file + ' reload')
|
||||
data = public.execShell(__SR + file + ' restart')
|
||||
if data[1] == '':
|
||||
return 'ok'
|
||||
return data[1]
|
||||
@@ -245,7 +272,7 @@ def restart():
|
||||
|
||||
def reload():
|
||||
file = initDreplace()
|
||||
data = public.execShell(file + ' reload')
|
||||
data = public.execShell(__SR + file + ' reload')
|
||||
if data[1] == '':
|
||||
return 'ok'
|
||||
return data[1]
|
||||
@@ -273,6 +300,7 @@ def initdInstall():
|
||||
initd_bin = getInitDFile()
|
||||
shutil.copyfile(mem_bin, initd_bin)
|
||||
public.execShell('chmod +x ' + initd_bin)
|
||||
public.execShell('chkconfig --add ' + getPluginName())
|
||||
return 'ok'
|
||||
|
||||
|
||||
@@ -283,6 +311,7 @@ def initdUinstall():
|
||||
return "Apple Computer does not support"
|
||||
initd_bin = getInitDFile()
|
||||
os.remove(initd_bin)
|
||||
public.execShell('chkconfig --del ' + getPluginName())
|
||||
return 'ok'
|
||||
|
||||
|
||||
@@ -476,7 +505,7 @@ def projectScriptEdit():
|
||||
user = args['user']
|
||||
name = args['name'] + '.git'
|
||||
post_receive = getRootPath() + '/' + user + '/' + name + \
|
||||
'/custom_hooks/post-receive'
|
||||
'/custom_hooks/commit'
|
||||
if os.path.exists(post_receive):
|
||||
return public.returnJson(True, 'OK', {'path': post_receive})
|
||||
else:
|
||||
@@ -512,7 +541,9 @@ def projectScriptLoad():
|
||||
codeDir = public.getRootDir() + '/git'
|
||||
|
||||
cc_content = public.readFile(commit_tpl)
|
||||
cc_content = cc_content.replace('{$GITROOTURL}', getRootUrl())
|
||||
|
||||
sshUrl = 'ssh://127.0.0.1:' + getSshPort()
|
||||
cc_content = cc_content.replace('{$GITROOTURL}', sshUrl)
|
||||
cc_content = cc_content.replace('{$CODE_DIR}', codeDir)
|
||||
cc_content = cc_content.replace('{$USERNAME}', user)
|
||||
cc_content = cc_content.replace('{$PROJECT}', args['name'])
|
||||
@@ -574,6 +605,17 @@ def gogsEdit():
|
||||
return public.getJson(data)
|
||||
|
||||
|
||||
def getRsaPublic():
|
||||
path = getHomeDir()
|
||||
path += '/.ssh/id_rsa.pub'
|
||||
|
||||
content = public.readFile(path)
|
||||
|
||||
data = {}
|
||||
data['public'] = content
|
||||
return public.getJson(data)
|
||||
|
||||
|
||||
def getTotalStatistics():
|
||||
st = status()
|
||||
data = {}
|
||||
@@ -591,6 +633,7 @@ def getTotalStatistics():
|
||||
data['count'] = 0
|
||||
return public.returnJson(False, 'fail', data)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
func = sys.argv[1]
|
||||
if func == 'status':
|
||||
@@ -635,6 +678,8 @@ if __name__ == "__main__":
|
||||
print projectScriptDebug()
|
||||
elif func == 'gogs_edit':
|
||||
print gogsEdit()
|
||||
elif func == 'get_rsa_public':
|
||||
print getRsaPublic()
|
||||
elif func == 'get_total_statistics':
|
||||
print getTotalStatistics()
|
||||
else:
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"ps": "Gogs是一款极易搭建的自助Git服务",
|
||||
"name": "gogs",
|
||||
"title": "Gogs",
|
||||
"versions": ["0.11.86","0.11.79"],
|
||||
"versions": ["0.11.86"],
|
||||
"tip": "soft",
|
||||
"checks": "server/gogs",
|
||||
"author": "midoks",
|
||||
|
||||
@@ -25,12 +25,17 @@ if [ -f /etc/init.d/functions ];then
|
||||
. /etc/init.d/functions
|
||||
fi
|
||||
|
||||
if [ -f /etc/rc.d/init.d/functions ];then
|
||||
. /etc/rc.d/init.d/functions
|
||||
fi
|
||||
|
||||
# Default values
|
||||
HOME={$HOME_DIR}
|
||||
export HOME={$HOME_DIR}
|
||||
export USER={$RUN_USER}
|
||||
NAME=gogs
|
||||
GOGS_HOME={$SERVER_PATH}/gogs
|
||||
GOGS_PATH=${GOGS_HOME}/$NAME
|
||||
GOGS_USER=midoks
|
||||
GOGS_USER={$RUN_USER}
|
||||
SERVICENAME="Gogs"
|
||||
LOCKFILE=/tmp/gogs.lock
|
||||
LOGPATH=${GOGS_HOME}/log
|
||||
@@ -38,12 +43,17 @@ LOGFILE=${LOGPATH}/gogs.log
|
||||
RETVAL=0
|
||||
|
||||
|
||||
[ -r /etc/sysconfig/$NAME ] && . /etc/sysconfig/$NAME
|
||||
DAEMON_OPTS="--check $NAME"
|
||||
[ ! -z "$GOGS_USER" ] && DAEMON_OPTS="$DAEMON_OPTS --user=${GOGS_USER}"
|
||||
|
||||
|
||||
status(){
|
||||
isStart=`ps -ef|grep 'gogs web' |grep -v grep|awk '{print $2}'`
|
||||
if [ "$isStart" == '' ];then
|
||||
echo "${SERVICENAME} not running"
|
||||
echo -e "${SERVICENAME} not running"
|
||||
else
|
||||
echo "${SERVICENAME}(pid $(echo $isStart)) already running"
|
||||
echo -e "${SERVICENAME}(pid $(echo $isStart)) already running"
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -55,24 +65,23 @@ start() {
|
||||
fi
|
||||
|
||||
cd ${GOGS_HOME}
|
||||
echo "Starting ${SERVICENAME}: \c"
|
||||
echo -e "Starting ${SERVICENAME}: \c"
|
||||
${GOGS_PATH} web > ${LOGFILE} 2>&1 &
|
||||
RETVAL=$?
|
||||
[ $RETVAL = 0 ] && touch ${LOCKFILE} && echo "\033[32mdone\033[0m"
|
||||
[ $RETVAL = 0 ] && touch ${LOCKFILE} && echo -e "\033[32mdone\033[0m"
|
||||
return $RETVAL
|
||||
}
|
||||
|
||||
stop() {
|
||||
cd ${GOGS_HOME}
|
||||
echo "Shutting down ${SERVICENAME}: \c"
|
||||
which "killproc" > /dev/null
|
||||
if [ $? -eq 0 ];then
|
||||
killproc ${NAME}
|
||||
else
|
||||
pkill ${NAME}
|
||||
fi
|
||||
RETVAL=$?
|
||||
[ $RETVAL = 0 ] && rm -f ${LOCKFILE} && echo "\033[32mdone\033[0m"
|
||||
|
||||
pids=`ps -ef|grep 'gogs web' |grep -v grep|awk '{print $2}'`
|
||||
arr=($pids)
|
||||
echo -e "Stopping gogs... \c"
|
||||
for p in ${arr[@]}
|
||||
do
|
||||
kill -9 $p
|
||||
done
|
||||
echo -e "\033[32mdone\033[0m"
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
|
||||
@@ -7,7 +7,7 @@ rootPath=$(dirname "$curPath")
|
||||
rootPath=$(dirname "$rootPath")
|
||||
serverPath=$(dirname "$rootPath")
|
||||
|
||||
install_tmp=${rootPath}/tmp/bt_install.pl
|
||||
install_tmp=${rootPath}/tmp/mw_install.pl
|
||||
|
||||
|
||||
GOGS_DOWNLOAD='https://dl.gogs.io'
|
||||
@@ -49,6 +49,14 @@ Install_gogs()
|
||||
mv $serverPath/source/gogs/gogs_${version}/gogs/ $serverPath/gogs
|
||||
echo $version > $serverPath/gogs/version.pl
|
||||
|
||||
# if id -u gogs > /dev/null 2>&1; then
|
||||
# echo "gogs user exists"
|
||||
# else
|
||||
# useradd gogs
|
||||
# cp /etc/sudoers{,.`date +"%Y-%m-%d_%H-%M-%S"`}
|
||||
# echo "gogs ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
|
||||
# fi
|
||||
|
||||
echo 'install success' > $install_tmp
|
||||
}
|
||||
|
||||
|
||||
@@ -87,13 +87,12 @@ function gogsSetConfig(){
|
||||
//提交PHP配置
|
||||
function submitGogsConf() {
|
||||
var data = {
|
||||
DOMAIN: $("select[name='DOMAIN']").val(),
|
||||
ROOT_URL: $("select[name='ROOT_URL']").val(),
|
||||
DOMAIN: $("input[name='DOMAIN']").val(),
|
||||
ROOT_URL: $("input[name='ROOT_URL']").val(),
|
||||
HTTP_ADDR: $("select[name='HTTP_ADDR']").val(),
|
||||
HTTP_PORT: $("select[name='HTTP_PORT']").val(),
|
||||
HTTP_PORT: $("input[name='HTTP_PORT']").val(),
|
||||
START_SSH_SERVER: $("select[name='START_SSH_SERVER']").val() || 'false',
|
||||
SSH_PORT: $("select[name='SSH_PORT']").val(),
|
||||
ROOT_URL: $("select[name='ROOT_URL']").val(),
|
||||
SSH_PORT: $("input[name='SSH_PORT']").val(),
|
||||
REQUIRE_SIGNIN_VIEW: $("select[name='REQUIRE_SIGNIN_VIEW']").val() || 'false',
|
||||
ENABLE_CAPTCHA: $("select[name='ENABLE_CAPTCHA']").val() || 'true',
|
||||
DISABLE_REGISTRATION: $("select[name='DISABLE_REGISTRATION']").val() || 'false',
|
||||
@@ -313,8 +312,35 @@ function projectScriptDebug(user,name){
|
||||
});
|
||||
}
|
||||
|
||||
function getRsaPublic(){
|
||||
gogsPost('get_rsa_public', {}, function(data){
|
||||
var rdata = $.parseJSON(data.data);
|
||||
var con = '<div class="tab-con">\
|
||||
<div class="myKeyCon ptb15">\
|
||||
<textarea style="margin:0px;width:580px;height:110px;outline:none;" spellcheck="false">'+rdata.public+'</textarea>\
|
||||
</div>\
|
||||
<ul class="help-info-text c7 pull-left"></ul>\
|
||||
</div>'
|
||||
layer.open({
|
||||
type: 1,
|
||||
area: "600px",
|
||||
title: '本机公钥',
|
||||
closeBtn: 2,
|
||||
shift: 5,
|
||||
shadeClose: false,
|
||||
content:con
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function gogsRead(){
|
||||
var readme = '<p>* 默认使用MySQL,第一个启动加载各种配置,并修改成正确的数据库配置</p>';
|
||||
readme += '<p>* 邮件端口使用456,gogs仅支持使用STARTTLS的SMTP协议</p>';
|
||||
|
||||
var readme = '<ul class="help-info-text c7">';
|
||||
readme += '<li>默认使用MySQL,第一个启动加载各种配置,并修改成正确的数据库配置</li>';
|
||||
readme += '<li>邮件端口使用456,gogs仅支持使用STARTTLS的SMTP协议</li>';
|
||||
readme += '<li>如果使用项目中脚本本地同步,<a target="_blank" href="https://github.com/midoks/mdserver-web/wiki/%E6%8F%92%E4%BB%B6%E7%AE%A1%E7%90%86%5Bgogs%E4%BD%BF%E7%94%A8%E8%AF%B4%E6%98%8E%5D#%E5%90%AF%E5%8A%A8gogs%E5%90%8E%E5%A6%82%E6%9E%9C%E8%A6%81%E4%BD%BF%E7%94%A8hook%E8%84%9A%E6%9C%AC%E5%90%8C%E6%AD%A5%E4%BB%A3%E7%A0%81%E9%9C%80%E8%A6%81%E5%BC%80%E5%90%AFssh%E7%AB%AF%E5%8F%A3">点击查看</></li>';
|
||||
readme += '<li><a href="#" onclick="getRsaPublic();">点击查看本机公钥</></li>';
|
||||
readme += '</ul>';
|
||||
|
||||
$('.soft-man-con').html(readme);
|
||||
}
|
||||
@@ -194,10 +194,12 @@ def initdInstall():
|
||||
if public.isAppleSystem():
|
||||
return "Apple Computer does not support"
|
||||
|
||||
|
||||
mem_bin = initDreplace()
|
||||
initd_bin = getInitDFile()
|
||||
shutil.copyfile(mem_bin, initd_bin)
|
||||
public.execShell('chmod +x ' + initd_bin)
|
||||
public.execShell('chkconfig --add ' + getPluginName())
|
||||
return 'ok'
|
||||
|
||||
|
||||
@@ -205,6 +207,8 @@ def initdUinstall():
|
||||
if not app_debug:
|
||||
if public.isAppleSystem():
|
||||
return "Apple Computer does not support"
|
||||
|
||||
public.execShell('chkconfig --del ' + getPluginName())
|
||||
initd_bin = getInitDFile()
|
||||
os.remove(initd_bin)
|
||||
return 'ok'
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#!/bin/bash
|
||||
|
||||
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
|
||||
export PATH
|
||||
|
||||
@@ -7,35 +8,31 @@ rootPath=$(dirname "$curPath")
|
||||
rootPath=$(dirname "$rootPath")
|
||||
serverPath=$(dirname "$rootPath")
|
||||
|
||||
|
||||
install_tmp=${rootPath}/tmp/bt_install.pl
|
||||
install_tmp=${rootPath}/tmp/mw_install.pl
|
||||
|
||||
|
||||
Install_mem()
|
||||
{
|
||||
Install_mem(){
|
||||
mkdir -p $serverPath/source
|
||||
|
||||
echo '正在安装脚本文件...' > $install_tmp
|
||||
|
||||
if [ ! -f $serverPath/source/memcached.tar.gz ];then
|
||||
wget -O $serverPath/source/memcached.tar.gz http://www.memcached.org/files/memcached-1.5.12.tar.gz
|
||||
if
|
||||
fi
|
||||
|
||||
cd $serverPath/source && tar -zxvf memcached.tar.gz
|
||||
|
||||
mkdir -p $serverPath/memcached
|
||||
cd memcached* && ./configure --prefix=$serverPath/memcached && make && make install
|
||||
cd $serverPath/source/memcached*
|
||||
./configure --prefix=$serverPath/memcached && make && make install
|
||||
|
||||
echo '1.5' > $serverPath/memcached/version.pl
|
||||
|
||||
echo '安装完成' > $install_tmp
|
||||
|
||||
echo 'install ok' > $install_tmp
|
||||
}
|
||||
|
||||
Uninstall_mem()
|
||||
{
|
||||
$serverPath/memcached/init.d/memcached stop
|
||||
rm -rf mkdir -p $serverPath/memcached
|
||||
${serverPath}/memcached/init.d/memcached stop
|
||||
rm -rf $serverPath/memcached
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
Before Width: | Height: | Size: 515 B After Width: | Height: | Size: 388 B |
@@ -31,6 +31,7 @@
|
||||
<p class="bgw" onclick="pluginService('mysql');">服务</p>
|
||||
<p onclick="pluginInitD('mysql');">自启动</p>
|
||||
<p onclick="pluginConfig('mysql');">配置文件</p>
|
||||
<p onclick="myDbPos();">存储位置</p>
|
||||
<p onclick="myPort();">端口</p>
|
||||
<p onclick="runInfo();">当前状态</p>
|
||||
<p onclick="myPerfOpt();">性能优化</p>
|
||||
|
||||
@@ -151,10 +151,6 @@ def getDataDir():
|
||||
|
||||
def binLog():
|
||||
args = getArgs()
|
||||
# data = checkArgs(args, ['status'])
|
||||
# if not data[0]:
|
||||
# return data[1]
|
||||
|
||||
conf = getConf()
|
||||
con = public.readFile(conf)
|
||||
|
||||
@@ -163,7 +159,7 @@ def binLog():
|
||||
return public.returnJson(False, '0')
|
||||
con = con.replace('#log-bin=mysql-bin', 'log-bin=mysql-bin')
|
||||
con = con.replace('#binlog_format=mixed', 'binlog_format=mixed')
|
||||
os.system('sync')
|
||||
public.execShell('sync')
|
||||
restart()
|
||||
else:
|
||||
path = getDataDir()
|
||||
@@ -177,9 +173,9 @@ def binLog():
|
||||
return public.returnJson(True, dsize)
|
||||
con = con.replace('log-bin=mysql-bin', '#log-bin=mysql-bin')
|
||||
con = con.replace('binlog_format=mixed', '#binlog_format=mixed')
|
||||
os.system('sync')
|
||||
public.execShell('sync')
|
||||
restart()
|
||||
os.system('rm -f ' + path + '/mysql-bin.*')
|
||||
public.execShell('rm -f ' + path + '/mysql-bin.*')
|
||||
|
||||
public.writeFile(conf, con)
|
||||
return public.returnJson(True, '设置成功!')
|
||||
@@ -195,12 +191,14 @@ def getErrorLog():
|
||||
if n == 'error.log':
|
||||
filename = path + '/' + n
|
||||
break
|
||||
print filename
|
||||
if not os.path.exists(filename):
|
||||
return public.returnJson(False, '指定文件不存在!')
|
||||
if args.has_key('close'):
|
||||
public.writeFile(filename, '')
|
||||
return public.returnJson(True, '日志已清空')
|
||||
return public.getNumLines(filename, 1000)
|
||||
return public.returnJson(False, '日志已清空')
|
||||
info = public.getNumLines(filename, 1000)
|
||||
return public.returnJson(True, 'OK', info)
|
||||
|
||||
|
||||
def getShowLogFile():
|
||||
@@ -295,6 +293,7 @@ def initdInstall():
|
||||
initd_bin = getInitDFile()
|
||||
shutil.copyfile(mysql_bin, initd_bin)
|
||||
public.execShell('chmod +x ' + initd_bin)
|
||||
public.execShell('chkconfig --add ' + getPluginName())
|
||||
return 'ok'
|
||||
|
||||
|
||||
@@ -302,11 +301,63 @@ def initdUinstall():
|
||||
if not app_debug:
|
||||
if public.isAppleSystem():
|
||||
return "Apple Computer does not support"
|
||||
public.execShell('chkconfig --del ' + getPluginName())
|
||||
initd_bin = getInitDFile()
|
||||
os.remove(initd_bin)
|
||||
return 'ok'
|
||||
|
||||
|
||||
def getMyDbPos():
|
||||
file = getConf()
|
||||
content = public.readFile(file)
|
||||
rep = 'datadir\s*=\s*(.*)'
|
||||
tmp = re.search(rep, content)
|
||||
return tmp.groups()[0].strip()
|
||||
|
||||
|
||||
def setMyDbPos():
|
||||
args = getArgs()
|
||||
data = checkArgs(args, ['datadir'])
|
||||
if not data[0]:
|
||||
return data[1]
|
||||
|
||||
s_datadir = getMyDbPos()
|
||||
t_datadir = args['datadir']
|
||||
if t_datadir == s_datadir:
|
||||
return public.returnJson(False, '与当前存储目录相同,无法迁移文件!')
|
||||
|
||||
if not os.path.exists(t_datadir):
|
||||
public.execShell('mkdir -p ' + t_datadir)
|
||||
|
||||
# public.execShell('/etc/init.d/mysqld stop')
|
||||
stop()
|
||||
public.execShell('cp -rf ' + s_datadir + '/* ' + t_datadir + '/')
|
||||
public.execShell('chown -R mysql.mysql ' + t_datadir)
|
||||
public.execShell('chmod -R 755 ' + t_datadir)
|
||||
public.execShell('rm -f ' + t_datadir + '/*.pid')
|
||||
public.execShell('rm -f ' + t_datadir + '/*.err')
|
||||
|
||||
path = getServerDir()
|
||||
myfile = path + '/etc/my.cnf'
|
||||
mycnf = public.readFile(myfile)
|
||||
public.writeFile(path + '/etc/my_backup.cnf', mycnf)
|
||||
|
||||
mycnf = mycnf.replace(s_datadir, t_datadir)
|
||||
public.writeFile(myfile, mycnf)
|
||||
start()
|
||||
|
||||
result = public.execShell(
|
||||
'ps aux|grep mysqld| grep -v grep|grep -v python')
|
||||
if len(result[0]) > 10:
|
||||
public.writeFile('data/datadir.pl', t_datadir)
|
||||
return public.returnJson(True, '存储目录迁移成功!')
|
||||
else:
|
||||
public.execShell('pkill -9 mysqld')
|
||||
public.writeFile(myfile, public.readFile(path + '/etc/my_backup.cnf'))
|
||||
start()
|
||||
return public.returnJson(False, '文件迁移失败!')
|
||||
|
||||
|
||||
def getMyPort():
|
||||
file = getConf()
|
||||
content = public.readFile(file)
|
||||
@@ -317,8 +368,9 @@ def getMyPort():
|
||||
|
||||
def setMyPort():
|
||||
args = getArgs()
|
||||
if not 'port' in args:
|
||||
return 'port missing'
|
||||
data = checkArgs(args, ['port'])
|
||||
if not data[0]:
|
||||
return data[1]
|
||||
|
||||
port = args['port']
|
||||
file = getConf()
|
||||
@@ -586,8 +638,10 @@ def syncToDatabases():
|
||||
|
||||
def setRootPwd():
|
||||
args = getArgs()
|
||||
if not 'password' in args:
|
||||
return 'password missing'
|
||||
data = checkArgs(args, ['password'])
|
||||
if not data[0]:
|
||||
return data[1]
|
||||
|
||||
password = args['password']
|
||||
try:
|
||||
pdb = pMysqlDb()
|
||||
@@ -648,15 +702,31 @@ def setUserPwd():
|
||||
return isError
|
||||
pdb.execute("flush privileges")
|
||||
psdb.where("id=?", (id,)).setField('password', newpassword)
|
||||
return public.returnJson(True, public.getInfo('修改数据库[{1}]密码成功!', (name)))
|
||||
return public.returnJson(True, public.getInfo('修改数据库[{1}]密码成功!', (name,)))
|
||||
except Exception as ex:
|
||||
print str(ex)
|
||||
return public.returnJson(False, public.getInfo('修改数据库[{1}]密码失败!', (name)))
|
||||
# print str(ex)
|
||||
return public.returnJson(False, public.getInfo('修改数据库[{1}]密码失败!', (name,)))
|
||||
|
||||
|
||||
def setDbPs():
|
||||
args = getArgs()
|
||||
data = checkArgs(args, ['id', 'name', 'ps'])
|
||||
if not data[0]:
|
||||
return data[1]
|
||||
|
||||
ps = args['ps']
|
||||
sid = args['id']
|
||||
name = args['name']
|
||||
try:
|
||||
psdb = pSqliteDb('databases')
|
||||
psdb.where("id=?", (sid,)).setField('ps', ps)
|
||||
return public.returnJson(True, public.getInfo('修改数据库[{1}]备注成功!', (name,)))
|
||||
except Exception as e:
|
||||
return public.returnJson(True, public.getInfo('修改数据库[{1}]备注失败!', (name,)))
|
||||
|
||||
|
||||
def addDb():
|
||||
args = getArgs()
|
||||
|
||||
data = checkArgs(args,
|
||||
['password', 'name', 'codeing', 'db_user', 'dataAccess', 'ps'])
|
||||
if not data[0]:
|
||||
@@ -990,6 +1060,10 @@ if __name__ == "__main__":
|
||||
print getErrorLog()
|
||||
elif func == 'show_log':
|
||||
print getShowLogFile()
|
||||
elif func == 'my_db_pos':
|
||||
print getMyDbPos()
|
||||
elif func == 'set_db_pos':
|
||||
print setMyDbPos()
|
||||
elif func == 'my_port':
|
||||
print getMyPort()
|
||||
elif func == 'set_my_port':
|
||||
@@ -1014,6 +1088,8 @@ if __name__ == "__main__":
|
||||
print getDbAccess()
|
||||
elif func == 'set_db_access':
|
||||
print setDbAccess()
|
||||
elif func == 'set_db_ps':
|
||||
print setDbPs()
|
||||
elif func == 'get_db_info':
|
||||
print getDbInfo()
|
||||
elif func == 'repair_table':
|
||||
|
||||
@@ -4,7 +4,8 @@
|
||||
"name":"mysql",
|
||||
"type":"运行环境",
|
||||
"ps":"MySQL是一种关系数据库管理系统!",
|
||||
"versions":["5.5","5.6","5.7","8.0"],
|
||||
"todo_versions":["5.6","5.7","8.0"],
|
||||
"versions":["5.5"],
|
||||
"updates":["5.5.62"],
|
||||
"shell":"install.sh",
|
||||
"checks":"server/mysql",
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
#!/bin/sh
|
||||
# chkconfig: 2345 55 25
|
||||
# Description: mysql service
|
||||
# distro. For CentOS/Redhat run: 'chkconfig --add mysql'
|
||||
|
||||
# Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
|
||||
# This file is public domain and comes with NO WARRANTY of any kind
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ rootPath=$(dirname "$rootPath")
|
||||
serverPath=$(dirname "$rootPath")
|
||||
|
||||
|
||||
install_tmp=${rootPath}/tmp/bt_install.pl
|
||||
install_tmp=${rootPath}/tmp/mw_install.pl
|
||||
|
||||
|
||||
action=$1
|
||||
|
||||
@@ -88,6 +88,26 @@ function runInfo(){
|
||||
}
|
||||
|
||||
|
||||
function myDbPos(){
|
||||
myPost('my_db_pos','',function(data){
|
||||
var con = '<div class="line ">\
|
||||
<div class="info-r ml0">\
|
||||
<input id="datadir" name="datadir" class="bt-input-text mr5 port" type="text" style="width:330px" value="'+data.data+'">\
|
||||
<span class="glyphicon cursor mr5 glyphicon-folder-open icon_datadir" onclick="changePath(\'datadir\')"></span>\
|
||||
<button id="btn_change_path" name="btn_change_path" class="btn btn-success btn-sm mr5 ml5 btn_change_port">迁移</button>\
|
||||
</div></div>';
|
||||
$(".soft-man-con").html(con);
|
||||
|
||||
$('#btn_change_path').click(function(){
|
||||
var datadir = $("input[name='datadir']").val();
|
||||
myPost('set_db_pos','datadir='+datadir,function(data){
|
||||
var rdata = $.parseJSON(data.data);
|
||||
layer.msg(rdata.msg,{icon:rdata.status ? 1 : 5,time:2000,shade: [0.3, '#000']});
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function myPort(){
|
||||
myPost('my_port','',function(data){
|
||||
var con = '<div class="line ">\
|
||||
@@ -469,15 +489,6 @@ function copyPass(password){
|
||||
$("#bt_copys").click();
|
||||
}
|
||||
|
||||
function readerTableChecked(){
|
||||
$('table').find('th').find('input').bind('click',function(){
|
||||
$('table').find('td').find('input').each(function(i,obj){
|
||||
checked = $(this).prop('checked');
|
||||
$(this).prop('checked',!checked);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function checkSelect(){
|
||||
setTimeout(function () {
|
||||
var num = $('input[type="checkbox"].check:checked').length;
|
||||
@@ -749,36 +760,26 @@ function delDbBatch(){
|
||||
}
|
||||
|
||||
|
||||
function setDataByKey(tab, key, obj) {
|
||||
function setDbPs(id, name, obj) {
|
||||
var _span = $(obj);
|
||||
var _input = $("<input class='baktext' value="+_span.text()+" type='text' placeholder='备注信息' />");
|
||||
var _input = $("<input class='baktext' value=\""+_span.text()+"\" type='text' placeholder='备注信息' />");
|
||||
_span.hide().after(_input);
|
||||
_input.focus();
|
||||
_input.blur(function(){
|
||||
// var item = $(this).parents('tr').data('item');
|
||||
// console.log(item);
|
||||
// var _txt = $(this);
|
||||
// var data = {table:tab,id:item.id};
|
||||
// data[key] = _txt.val()
|
||||
// bt.pub.set_data_ps(data,function(rdata){
|
||||
// if(rdata.status){
|
||||
// _span.text(_txt.val());
|
||||
// _span.show();
|
||||
// _txt.remove();
|
||||
// }
|
||||
// })
|
||||
})
|
||||
$(this).remove();
|
||||
var ps = _input.val();
|
||||
_span.text(ps).show();
|
||||
var data = {name:name,id:id,ps:ps};
|
||||
myPost('set_db_ps', data, function(data){
|
||||
var rdata = $.parseJSON(data.data);
|
||||
layer.msg(rdata.msg, { icon: rdata.status ? 1 : 2 });
|
||||
});
|
||||
});
|
||||
_input.keyup(function(){
|
||||
if(event.keyCode == 13){
|
||||
_input.trigger('blur');
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function setDbPs(data,callback){
|
||||
bt.send('setPs','data/setPs',data,function(rdata){
|
||||
if(callback) callback(rdata);
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
function openPhpmyadmin(name,username,password){
|
||||
@@ -847,7 +848,7 @@ function dbList(page, search){
|
||||
'<span class="ico-copy cursor btcopy" style="margin-left:10px" title="复制密码" onclick="copyPass(\''+rdata.data[i]['password']+'\')"></span>'+
|
||||
'</td>';
|
||||
// list += '<td>备份</td>';
|
||||
list += '<td><span class="c9 input-edit" onclick="setDataByKey(\'databases\',\'ps\',this)" style="display: inline-block;">'+rdata.data[i]['ps']+'</span></td>';
|
||||
list += '<td><span class="c9 input-edit" onclick="setDbPs(\''+rdata.data[i]['id']+'\',\''+rdata.data[i]['name']+'\',this)" style="display: inline-block;">'+rdata.data[i]['ps']+'</span></td>';
|
||||
list += '<td style="text-align:right">' +
|
||||
'<a href="javascript:;" class="btlink" onclick="openPhpmyadmin(\''+rdata.data[i]['name']+'\',\''+rdata.data[i]['username']+'\',\''+rdata.data[i]['password']+'\')" title="数据库管理">管理</a> | ' +
|
||||
'<a href="javascript:;" class="btlink" onclick="repTools(\''+rdata.data[i]['name']+'\')" title="MySQL优化修复工具">工具</a> | ' +
|
||||
@@ -944,9 +945,12 @@ function myLogs(){
|
||||
})
|
||||
|
||||
myPost('error_log', 'p=1', function(data){
|
||||
var error_body = data.data;
|
||||
if (error_body == "") {
|
||||
error_body = '当前没有日志内容!';
|
||||
var rdata = $.parseJSON(data.data);
|
||||
var error_body = '';
|
||||
if (rdata.status){
|
||||
error_body = rdata.data;
|
||||
} else {
|
||||
error_body = rdata.msg;
|
||||
}
|
||||
$("#error_log").text(error_body);
|
||||
var ob = document.getElementById('error_log');
|
||||
|
||||
@@ -11,7 +11,7 @@ rootPath=$(dirname "$rootPath")
|
||||
serverPath=$(dirname "$rootPath")
|
||||
|
||||
|
||||
install_tmp=${rootPath}/tmp/bt_install.pl
|
||||
install_tmp=${rootPath}/tmp/mw_install.pl
|
||||
mysqlDir=${serverPath}/source/mysql
|
||||
|
||||
Install_mysql()
|
||||
@@ -54,7 +54,7 @@ Install_mysql()
|
||||
|
||||
Uninstall_mysql()
|
||||
{
|
||||
#rm -rf $serverPath/mysql
|
||||
rm -rf $serverPath/mysql
|
||||
echo '卸载完成' > $install_tmp
|
||||
}
|
||||
|
||||
|
||||
|
Before Width: | Height: | Size: 501 B After Width: | Height: | Size: 344 B |
@@ -232,6 +232,7 @@ def initdInstall():
|
||||
initd_bin = getInitDFile()
|
||||
shutil.copyfile(source_bin, initd_bin)
|
||||
public.execShell('chmod +x ' + initd_bin)
|
||||
public.execShell('chkconfig --add ' + getPluginName())
|
||||
return 'ok'
|
||||
|
||||
|
||||
@@ -239,6 +240,8 @@ def initdUinstall():
|
||||
if not app_debug:
|
||||
if public.isAppleSystem():
|
||||
return "Apple Computer does not support"
|
||||
|
||||
public.execShell('chkconfig --del ' + getPluginName())
|
||||
initd_bin = getInitDFile()
|
||||
os.remove(initd_bin)
|
||||
return 'ok'
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
# chkconfig: 2345 55 25
|
||||
# Description: Startup script for nginx webserver on Debian. Place in /etc/init.d and
|
||||
# run 'update-rc.d -f nginx defaults', or use the appropriate command on your
|
||||
# distro. For CentOS/Redhat run: 'chkconfig --add nginx'
|
||||
# distro. For CentOS/Redhat run: 'chkconfig --add openresty'
|
||||
|
||||
### BEGIN INIT INFO
|
||||
# Provides: nginx
|
||||
|
||||
@@ -74,6 +74,7 @@ function orPluginOpService(a, b, v) {
|
||||
});
|
||||
} else {
|
||||
orPluginOpServiceOp(a,b,c,d,a,v);
|
||||
|
||||
}
|
||||
});
|
||||
})
|
||||
@@ -98,6 +99,10 @@ function orPluginOpServiceOp(a,b,c,d,a,v){
|
||||
if( g.status && g.data != 'ok' ) {
|
||||
layer.msg(g.data, {icon: 2,time: 3000,shade: 0.3,shadeClose: true});
|
||||
}
|
||||
|
||||
setTimeout(function(){
|
||||
location.reload();
|
||||
},2000);
|
||||
},'json').error(function() {
|
||||
layer.close(e);
|
||||
layer.msg('操作异常!', {icon: 2});
|
||||
@@ -151,7 +156,7 @@ function nginxSoftMain(name, version) {
|
||||
layer.open({
|
||||
type: 1,
|
||||
area: '640px',
|
||||
title: name + lan.soft.admin,
|
||||
title: name + '管理',
|
||||
closeBtn: 2,
|
||||
shift: 0,
|
||||
content: '<div class="bt-w-main" style="width:640px;">\
|
||||
|
||||
@@ -8,7 +8,7 @@ rootPath=$(dirname "$rootPath")
|
||||
serverPath=$(dirname "$rootPath")
|
||||
|
||||
|
||||
install_tmp=${rootPath}/tmp/bt_install.pl
|
||||
install_tmp=${rootPath}/tmp/mw_install.pl
|
||||
openrestyDir=${serverPath}/source/openresty
|
||||
|
||||
Install_openresty()
|
||||
|
||||
@@ -7,7 +7,7 @@ rootPath=$(dirname "$curPath")
|
||||
rootPath=$(dirname "$rootPath")
|
||||
serverPath=$(dirname "$rootPath")
|
||||
|
||||
install_tmp=${rootPath}/tmp/bt_install.pl
|
||||
install_tmp=${rootPath}/tmp/mw_install.pl
|
||||
|
||||
openrestyDir=${serverPath}/source/openresty
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ allow_url_fopen = On
|
||||
allow_url_include = Off
|
||||
default_socket_timeout = 60
|
||||
|
||||
disable_functions = phpinfo,exec,passthru,shell_exec,system,proc_open,popen,curl_exec,curl_multi_exec,parse_ini_file,show_source
|
||||
disable_functions = exec,passthru,shell_exec,system,proc_open,popen,curl_exec,curl_multi_exec,parse_ini_file,show_source
|
||||
|
||||
[CLI Server]
|
||||
cli_server.color = On
|
||||
@@ -212,8 +212,3 @@ ldap.max_links = -1
|
||||
[dba]
|
||||
[curl]
|
||||
[Zend Opcache]
|
||||
|
||||
;[xhprof]
|
||||
;extension=md_xhprof.so
|
||||
;xhprof.output_dir="MD:/bin/tmp/xhprof"
|
||||
|
||||
@@ -44,7 +44,7 @@ allow_url_fopen = On
|
||||
allow_url_include = Off
|
||||
default_socket_timeout = 60
|
||||
|
||||
disable_functions = phpinfo,exec,passthru,shell_exec,system,proc_open,popen,curl_exec,curl_multi_exec,parse_ini_file,show_source
|
||||
disable_functions = exec,passthru,shell_exec,system,proc_open,popen,curl_exec,curl_multi_exec,parse_ini_file,show_source
|
||||
|
||||
[CLI Server]
|
||||
cli_server.color = On
|
||||
@@ -211,26 +211,3 @@ ldap.max_links = -1
|
||||
[dba]
|
||||
[curl]
|
||||
[Zend Opcache]
|
||||
|
||||
;[xhprof]
|
||||
;extension=md_xhprof.so
|
||||
;xhprof.output_dir="MD:/bin/tmp/xhprof"
|
||||
|
||||
|
||||
;extension=igbinary.so
|
||||
;extension=iconv.so
|
||||
;extension=yaf.so
|
||||
;extension=swoole.so
|
||||
;extension=curl.so
|
||||
;extension=bcmath.so
|
||||
;extension=mcrypt.so
|
||||
;extension=gd.so
|
||||
;extension=openssl.so
|
||||
;extension=intl.so
|
||||
;extension=gettext.so
|
||||
;extension=imagick.so
|
||||
;extension=redis.so
|
||||
;extension=mongodb.so
|
||||
;extension=memcached.so
|
||||
;extension=phalcon.so
|
||||
;extension=opencv.so
|
||||
|
Before Width: | Height: | Size: 786 B After Width: | Height: | Size: 785 B |
@@ -3,6 +3,7 @@
|
||||
<div class="bt-w-main">
|
||||
<div class="bt-w-menu">
|
||||
<p class="bgw" onclick="pluginService('php', $('.plugin_version').attr('version'));">服务</p>
|
||||
<p onclick="pluginInitD('php', $('.plugin_version').attr('version'));">自启动</p>
|
||||
<p onclick="phpLibConfig($('.plugin_version').attr('version'));">安装扩展</p>
|
||||
<p onclick="phpSetConfig($('.plugin_version').attr('version'));">配置修改</p>
|
||||
<p onclick="phpUploadLimitReq($('.plugin_version').attr('version'));">上传限制</p>
|
||||
@@ -25,5 +26,4 @@
|
||||
$.getScript( "/plugins/file?name=php&f=js/php.js", function(){
|
||||
pluginService('php', $('.plugin_version').attr('version'));
|
||||
});
|
||||
|
||||
</script>
|
||||
@@ -12,6 +12,8 @@ reload(sys)
|
||||
sys.setdefaultencoding('utf8')
|
||||
|
||||
sys.path.append(os.getcwd() + "/class/core")
|
||||
sys.path.append("/usr/local/lib/python2.7/site-packages")
|
||||
|
||||
import public
|
||||
|
||||
app_debug = False
|
||||
@@ -31,10 +33,10 @@ def getServerDir():
|
||||
return public.getServerDir() + '/' + getPluginName()
|
||||
|
||||
|
||||
def getInitDFile():
|
||||
def getInitDFile(version):
|
||||
if app_debug:
|
||||
return '/tmp/' + getPluginName()
|
||||
return '/etc/init.d/' + getPluginName()
|
||||
return '/etc/init.d/' + getPluginName()+version
|
||||
|
||||
|
||||
def getArgs():
|
||||
@@ -111,7 +113,8 @@ def contentReplace(content, version):
|
||||
|
||||
def makeOpenrestyConf():
|
||||
if public.isInstalledWeb():
|
||||
d_pathinfo = public.getServerDir() + '/openresty/nginx/conf/pathinfo.conf'
|
||||
sdir = public.getServerDir()
|
||||
d_pathinfo = sdir + '/openresty/nginx/conf/pathinfo.conf'
|
||||
if not os.path.exists(d_pathinfo):
|
||||
s_pathinfo = getPluginDir() + '/conf/pathinfo.conf'
|
||||
shutil.copyfile(s_pathinfo, d_pathinfo)
|
||||
@@ -123,12 +126,21 @@ def makeOpenrestyConf():
|
||||
tpl = getPluginDir() + '/conf/enable-php.conf'
|
||||
tpl_content = public.readFile(tpl)
|
||||
for x in range(len(versions)):
|
||||
desc_file = public.getServerDir() + '/openresty/nginx/conf/enable-php-' + \
|
||||
versions[x] + '.conf'
|
||||
if not os.path.exists(desc_file):
|
||||
dfile = sdir + '/openresty/nginx/conf/enable-php-' + versions[x] + '.conf'
|
||||
if not os.path.exists(dfile):
|
||||
w_content = contentReplace(tpl_content, versions[x])
|
||||
public.writeFile(desc_file, w_content)
|
||||
|
||||
#php-fpm status
|
||||
phpversions = ['53','54','55','56','70','71','72','73','74']
|
||||
for version in phpversions:
|
||||
dfile = sdir + '/openresty/nginx/conf/php_status/phpfpm_status_' + version + '.conf'
|
||||
tpl = getPluginDir() + '/conf/phpfpm_status.conf'
|
||||
if not os.path.exists(dfile):
|
||||
content = public.readFile(tpl)
|
||||
content = contentReplace(content, version)
|
||||
public.writeFile(dfile, content)
|
||||
public.restartWeb()
|
||||
|
||||
def phpFpmReplace(version):
|
||||
desc_php_fpm = getServerDir() + '/' + version + '/etc/php-fpm.conf'
|
||||
@@ -156,7 +168,7 @@ def phpFpmWwwReplace(version):
|
||||
def makePhpIni(version):
|
||||
d_ini = public.getServerDir() + '/php/' + version + '/etc/php.ini'
|
||||
if not os.path.exists(d_ini):
|
||||
s_ini = getPluginDir() + '/conf/php' + version + '.ini'
|
||||
s_ini = getPluginDir() + '/conf/php' + version[0:1] + '.ini'
|
||||
shutil.copyfile(s_ini, d_ini)
|
||||
|
||||
|
||||
@@ -214,6 +226,41 @@ def reload(version):
|
||||
return phpOp(version, 'reload')
|
||||
|
||||
|
||||
def initdStatus(version):
|
||||
if not app_debug:
|
||||
if public.isAppleSystem():
|
||||
return "Apple Computer does not support"
|
||||
initd_bin = getInitDFile(version)
|
||||
if os.path.exists(initd_bin):
|
||||
return 'ok'
|
||||
return 'fail'
|
||||
|
||||
|
||||
def initdInstall(version):
|
||||
import shutil
|
||||
if not app_debug:
|
||||
if public.isAppleSystem():
|
||||
return "Apple Computer does not support"
|
||||
|
||||
source_bin = initReplace(version)
|
||||
initd_bin = getInitDFile(version)
|
||||
shutil.copyfile(source_bin, initd_bin)
|
||||
public.execShell('chmod +x ' + initd_bin)
|
||||
public.execShell('chkconfig --add ' + getPluginName()+version)
|
||||
return 'ok'
|
||||
|
||||
|
||||
def initdUinstall(version):
|
||||
if not app_debug:
|
||||
if public.isAppleSystem():
|
||||
return "Apple Computer does not support"
|
||||
|
||||
public.execShell('chkconfig --del ' + getPluginName())
|
||||
initd_bin = getInitDFile(version)
|
||||
os.remove(initd_bin)
|
||||
return 'ok'
|
||||
|
||||
|
||||
def fpmLog(version):
|
||||
return getServerDir() + '/' + version + '/var/log/php-fpm.log'
|
||||
|
||||
@@ -347,16 +394,8 @@ def setMaxSize(version):
|
||||
conf = re.sub(rep, u'\npost_max_size = ' + max + 'M', conf)
|
||||
public.writeFile(path, conf)
|
||||
|
||||
# if public.get_webserver() == 'nginx':
|
||||
# path = web.ctx.session.setupPath + '/nginx/conf/nginx.conf'
|
||||
# conf = public.readFile(path)
|
||||
# rep = "client_max_body_size\s+([0-9]+)m"
|
||||
# tmp = re.search(rep, conf).groups()
|
||||
# if int(tmp[0]) < int(max):
|
||||
# conf = re.sub(rep, 'client_max_body_size ' + max + 'm', conf)
|
||||
# public.writeFile(path, conf)
|
||||
|
||||
public.writeLog("TYPE_PHP", "PHP_UPLOAD_MAX", (version, max))
|
||||
msg = public.getInfo('设置PHP-{1}最大上传大小为[{2}MB]!',(version, max,))
|
||||
public.writeLog('插件管理[PHP]', msg)
|
||||
return public.returnJson(True, '设置成功!')
|
||||
|
||||
|
||||
@@ -421,20 +460,22 @@ def setFpmConfig(version):
|
||||
|
||||
public.writeFile(file, conf)
|
||||
reload(version)
|
||||
public.writeLog("TYPE_PHP", 'PHP_CHILDREN', (version, max_children,
|
||||
start_servers, min_spare_servers, max_spare_servers))
|
||||
return public.returnJson(True, '设置成功')
|
||||
|
||||
msg = public.getInfo('设置PHP-{1}并发设置,max_children={2},start_servers={3},min_spare_servers={4},max_spare_servers={5}',(version, max_children,
|
||||
start_servers, min_spare_servers, max_spare_servers,))
|
||||
public.writeLog('插件管理[PHP]', msg)
|
||||
return public.returnJson(True, '设置成功!')
|
||||
|
||||
|
||||
def checkFpmStatusFile(version):
|
||||
if public.isInstalledWeb():
|
||||
desc_file = public.getServerDir(
|
||||
) + '/openresty/nginx/conf/php_status/phpfpm_status_' + version + '.conf'
|
||||
if not os.path.exists(desc_file):
|
||||
sdir = public.getServerDir()
|
||||
dfile = sdir + '/openresty/nginx/conf/php_status/phpfpm_status_' + version + '.conf'
|
||||
if not os.path.exists(dfile):
|
||||
tpl = getPluginDir() + '/conf/phpfpm_status.conf'
|
||||
content = public.readFile(tpl)
|
||||
content = contentReplace(content, version)
|
||||
public.writeFile(desc_file, content)
|
||||
public.writeFile(dfile, content)
|
||||
public.restartWeb()
|
||||
|
||||
|
||||
@@ -471,39 +512,43 @@ def setDisableFunc(version):
|
||||
|
||||
phpini = public.readFile(filename)
|
||||
rep = "disable_functions\s*=\s*.*\n"
|
||||
phpini = re.sub(rep, 'disable_functions = ' +
|
||||
disable_functions + "\n", phpini)
|
||||
public.writeLog('TYPE_PHP', 'PHP_DISABLE_FUNCTION',
|
||||
(version, disable_functions))
|
||||
phpini = re.sub(rep, 'disable_functions = ' +disable_functions + "\n", phpini)
|
||||
|
||||
msg = public.getInfo('修改PHP-{1}的禁用函数为[{2}]',(version, disable_functions,))
|
||||
public.writeLog('插件管理[PHP]', msg)
|
||||
public.writeFile(filename, phpini)
|
||||
reload(version)
|
||||
return public.returnJson(True, '设置成功!')
|
||||
|
||||
|
||||
def checkPhpinfoFile(version):
|
||||
def checkPhpinfoFile(v):
|
||||
if public.isInstalledWeb():
|
||||
desc_file = public.getServerDir(
|
||||
) + '/openresty/nginx/conf/php_status/phpinfo_' + version + '.conf'
|
||||
if not os.path.exists(desc_file):
|
||||
sdir = public.getServerDir()
|
||||
dfile = sdir + '/openresty/nginx/conf/php_status/phpinfo_' + v + '.conf'
|
||||
if not os.path.exists(dfile):
|
||||
tpl = getPluginDir() + '/conf/phpinfo.conf'
|
||||
content = public.readFile(tpl)
|
||||
content = contentReplace(content, version)
|
||||
public.writeFile(desc_file, content)
|
||||
content = contentReplace(content, v)
|
||||
public.writeFile(dfile, content)
|
||||
public.restartWeb()
|
||||
|
||||
|
||||
def getPhpinfo(version):
|
||||
checkPhpinfoFile(version)
|
||||
sPath = public.getRootDir() + '/phpinfo/' + version
|
||||
# public.execShell("rm -rf " + public.getRootDir() + '/phpinfo')
|
||||
def getPhpinfo(v):
|
||||
checkPhpinfoFile(v)
|
||||
sPath = public.getRootDir() + '/phpinfo/' + v
|
||||
public.execShell("rm -rf " + public.getRootDir() + '/phpinfo')
|
||||
public.execShell("mkdir -p " + sPath)
|
||||
public.writeFile(sPath + '/phpinfo.php', '<?php phpinfo(); ?>')
|
||||
# print 'http://127.0.0.1/' + version + '/phpinfo.php'
|
||||
phpinfo = public.httpGet('http://127.0.0.1/' + version + '/phpinfo.php', 3)
|
||||
# os.system("rm -rf " + public.getRootDir() + '/phpinfo')
|
||||
url = 'http://127.0.0.1/' + v + '/phpinfo.php'
|
||||
phpinfo = public.httpGet(url)
|
||||
os.system("rm -rf " + public.getRootDir() + '/phpinfo')
|
||||
return phpinfo
|
||||
|
||||
|
||||
def get_php_info(args):
|
||||
return getPhpinfo(args['version'])
|
||||
|
||||
|
||||
def getLibConf(version):
|
||||
fname = public.getServerDir() + '/php/' + version + '/etc/php.ini'
|
||||
if not os.path.exists(fname):
|
||||
@@ -563,11 +608,12 @@ def uninstallLib(version):
|
||||
execstr = "cd " + getPluginDir() + '/versions/' + version + " && /bin/bash " + \
|
||||
name + '.sh' + ' uninstall ' + version
|
||||
|
||||
rettime = time.strftime('%Y-%m-%d %H:%M:%S')
|
||||
insert_info = (None, '安装[' + name + '-' + version + ']',
|
||||
'execshell', '0', rettime, execstr)
|
||||
public.M('tasks').add('id,name,type,status,addtime,execstr', insert_info)
|
||||
return public.returnJson(True, '已将卸载载任务添加到队列!')
|
||||
data = public.execShell(execstr)
|
||||
if data[0] == '' and data[1] == '':
|
||||
return public.returnJson(True, '已经卸载成功!')
|
||||
else:
|
||||
return public.returnJson(False, '卸载信息![通道0]:' + data[0] + "[通道0]:" + data[1])
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
@@ -588,6 +634,12 @@ if __name__ == "__main__":
|
||||
print restart(version)
|
||||
elif func == 'reload':
|
||||
print reload(version)
|
||||
elif func == 'initd_status':
|
||||
print initdStatus(version)
|
||||
elif func == 'initd_install':
|
||||
print initdInstall(version)
|
||||
elif func == 'initd_uninstall':
|
||||
print initdUinstall(version)
|
||||
elif func == 'fpm_log':
|
||||
print fpmLog(version)
|
||||
elif func == 'fpm_slow_log':
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
"name": "php",
|
||||
"title": "PHP",
|
||||
"coexist": true,
|
||||
"versions": ["52","56","72"],
|
||||
"updates": ["5.2.17","5.6.36","7.2.0"],
|
||||
"versions": ["53","54","55","56","70","71","72","73"],
|
||||
"updates": ["5.3.17","5.4.45","5.6.36","7.0.30","7.1.27","7.2.16","7.3.3"],
|
||||
"tip": "soft",
|
||||
"checks": "server/php/VERSION/bin/php",
|
||||
"path": "server/php/VERSION",
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
#! /bin/sh
|
||||
# chkconfig: 2345 55 25
|
||||
# description: PHP Service
|
||||
|
||||
### BEGIN INIT INFO
|
||||
# Provides: php-fpm
|
||||
|
||||
@@ -7,7 +7,7 @@ rootPath=$(dirname "$curPath")
|
||||
rootPath=$(dirname "$rootPath")
|
||||
serverPath=$(dirname "$rootPath")
|
||||
|
||||
install_tmp=${rootPath}/tmp/bt_install.pl
|
||||
install_tmp=${rootPath}/tmp/mw_install.pl
|
||||
|
||||
|
||||
action=$1
|
||||
|
||||
@@ -36,6 +36,33 @@ function phpPost(method, version, args,callback){
|
||||
},'json');
|
||||
}
|
||||
|
||||
function phpPostCallbak(method, version, args,callback){
|
||||
var loadT = layer.msg('正在获取...', { icon: 16, time: 0, shade: 0.3 });
|
||||
|
||||
var req_data = {};
|
||||
req_data['name'] = 'php';
|
||||
req_data['func'] = method;
|
||||
args['version'] = version;
|
||||
|
||||
if (typeof(args) == 'string'){
|
||||
req_data['args'] = JSON.stringify(str2Obj(args));
|
||||
} else {
|
||||
req_data['args'] = JSON.stringify(args);
|
||||
}
|
||||
|
||||
$.post('/plugins/callback', req_data, function(data) {
|
||||
layer.close(loadT);
|
||||
if (!data.status){
|
||||
layer.msg(data.msg,{icon:0,time:2000,shade: [0.3, '#000']});
|
||||
return;
|
||||
}
|
||||
|
||||
if(typeof(callback) == 'function'){
|
||||
callback(data);
|
||||
}
|
||||
},'json');
|
||||
}
|
||||
|
||||
|
||||
//配置修改
|
||||
function phpSetConfig(version) {
|
||||
@@ -373,12 +400,12 @@ function setDisableFunc(version, act, fs) {
|
||||
|
||||
//phpinfo
|
||||
function getPhpinfo(version) {
|
||||
var con = '<button class="btn btn-default btn-sm" onclick="getPHPInfo(\'' + version + '\')">' + lan.soft.phpinfo + '</button>';
|
||||
var con = '<button class="btn btn-default btn-sm" onclick="getPHPInfo(\'' + version + '\')">查看phpinfo()</button>';
|
||||
$(".soft-man-con").html(con);
|
||||
}
|
||||
|
||||
//获取PHPInfo
|
||||
function getPHPInfo(version) {
|
||||
function getPHPInfo_old(version) {
|
||||
phpPost('get_phpinfo', version, '', function(data){
|
||||
var rdata = data.data;
|
||||
layer.open({
|
||||
@@ -392,14 +419,38 @@ function getPHPInfo(version) {
|
||||
});
|
||||
}
|
||||
|
||||
function getPHPInfo(version) {
|
||||
phpPostCallbak('get_php_info', version, {}, function(data){
|
||||
if (!data.status){
|
||||
layer.msg(rdata.msg, { icon: 2 });
|
||||
}
|
||||
|
||||
layer.open({
|
||||
type: 1,
|
||||
title: "PHP-" + version + "-PHPINFO",
|
||||
area: ['90%', '90%'],
|
||||
closeBtn: 2,
|
||||
shadeClose: true,
|
||||
content: data.data
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
function phpLibConfig(version){
|
||||
|
||||
phpPost('get_lib_conf', version, '', function(data){
|
||||
var rdata = $.parseJSON(data.data);
|
||||
var libs = rdata.data;
|
||||
|
||||
if (!rdata.status){
|
||||
layer.msg(rdata.msg, { icon: rdata.status ? 1 : 2 });
|
||||
return;
|
||||
}
|
||||
|
||||
var libs = rdata.data;
|
||||
var body = '';
|
||||
var opt = '';
|
||||
|
||||
for (var i = 0; i < libs.length; i++) {
|
||||
if (libs[i].versions.indexOf(version) == -1){
|
||||
continue;
|
||||
@@ -457,9 +508,12 @@ function installPHPLib(version, name, title, pathinfo) {
|
||||
|
||||
phpPost('install_lib', version, data, function(data){
|
||||
var rdata = $.parseJSON(data.data);
|
||||
layer.msg(rdata.msg, { icon: rdata.status ? 1 : 2 });
|
||||
getTaskCount();
|
||||
phpLibConfig(version);
|
||||
// layer.msg(rdata.msg, { icon: rdata.status ? 1 : 2 });
|
||||
showMsg(rdata.msg, function(){
|
||||
getTaskCount();
|
||||
phpLibConfig(version);
|
||||
},{ icon: rdata.status ? 1 : 2 });
|
||||
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -471,9 +525,12 @@ function uninstallPHPLib(version, name, title, pathinfo) {
|
||||
var data = 'name=' + name + '&version=' + version;
|
||||
phpPost('uninstall_lib', version, data, function(data){
|
||||
var rdata = $.parseJSON(data.data);
|
||||
layer.msg(rdata.msg, { icon: rdata.status ? 1 : 2 });
|
||||
getTaskCount();
|
||||
phpLibConfig(version);
|
||||
// layer.msg(rdata.msg, { icon: rdata.status ? 1 : 2 });
|
||||
showMsg(rdata.msg, function(){
|
||||
getTaskCount();
|
||||
phpLibConfig(version);
|
||||
},{ icon: rdata.status ? 1 : 2 },5000);
|
||||
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -1,65 +0,0 @@
|
||||
#!/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")
|
||||
serverPath=$(dirname "$rootPath")
|
||||
sourcePath=${serverPath}/source
|
||||
|
||||
install_tmp=${rootPath}/tmp/bt_install.pl
|
||||
|
||||
# echo $curPath
|
||||
# echo ${1}
|
||||
# echo ${serverPath}
|
||||
# echo ${install_tmp}
|
||||
|
||||
|
||||
Install_php()
|
||||
{
|
||||
#------------------------ install start ------------------------------------#
|
||||
echo "安装php-5.2.17 ..." > $install_tmp
|
||||
mkdir -p $sourcePath/php
|
||||
mkdir -p $serverPath/php
|
||||
|
||||
if [ ! -f $sourcePath/php/php-5.2.17.tar.bz2 ];then
|
||||
wget -O $sourcePath/php/php-5.2.17.tar.bz2 https://museum.php.net/php5/php-5.2.17.tar.bz2
|
||||
fi
|
||||
|
||||
if [ ! -d $sourcePath/php/php-5.2.17 ];then
|
||||
cd $sourcePath/php && tar -Jxf $sourcePath/php/php-5.2.17.tar.bz2
|
||||
fi
|
||||
|
||||
|
||||
cd $sourcePath/php/php-5.2.17 && ./configure \
|
||||
--prefix=$serverPath/php/php52 \
|
||||
--exec-prefix=$serverPath/php/php52 \
|
||||
--with-config-file-path=$serverPath/php/php55/etc \
|
||||
--with-zlib-dir=$serverPath/lib/zlib \
|
||||
--without-iconv \
|
||||
--enable-zip \
|
||||
--enable-mbstring \
|
||||
--enable-ftp \
|
||||
--enable-wddx \
|
||||
--enable-soap \
|
||||
--enable-posix \
|
||||
--enable-fpm \
|
||||
&& make && make install
|
||||
|
||||
#------------------------ install end ------------------------------------#
|
||||
}
|
||||
|
||||
|
||||
|
||||
Uninstall_php()
|
||||
{
|
||||
echo "卸载php-5.2.17 ..." > $install_tmp
|
||||
}
|
||||
|
||||
action=${1}
|
||||
if [ "${1}" == 'install' ];then
|
||||
Install_php
|
||||
else
|
||||
Uninstall_php
|
||||
fi
|
||||
@@ -0,0 +1,92 @@
|
||||
#!/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=apc
|
||||
LIBV=3.1.9
|
||||
sysName=`uname`
|
||||
actionType=$1
|
||||
version=$2
|
||||
extFile=$serverPath/php/${version}/lib/php/extensions/no-debug-non-zts-20090626/${LIBNAME}.so
|
||||
|
||||
Install_lib()
|
||||
{
|
||||
isInstall=`cat $serverPath/php/$version/etc/php.ini|grep "${LIBNAME}.so"`
|
||||
if [ "${isInstall}" != "" ];then
|
||||
echo "php$version 已安装${LIBNAME},请选择其它版本!"
|
||||
return
|
||||
fi
|
||||
|
||||
if [ ! -f "$extFile" ];then
|
||||
|
||||
php_lib=$sourcePath/php_${version}_lib
|
||||
mkdir -p $php_lib
|
||||
|
||||
_LIBNAME=$(echo $LIBNAME | tr '[a-z]' '[A-Z]')
|
||||
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
|
||||
|
||||
cd $php_lib
|
||||
|
||||
rm -rf ${_LIBNAME}-${LIBV}
|
||||
rm -rf ${_LIBNAME}-${LIBV}.tgz
|
||||
fi
|
||||
|
||||
if [ ! -f "$extFile" ];then
|
||||
echo "ERROR!"
|
||||
return
|
||||
fi
|
||||
|
||||
echo "" >> $serverPath/php/$version/etc/php.ini
|
||||
echo "[${LIBNAME}]" >> $serverPath/php/$version/etc/php.ini
|
||||
echo "extension=${LIBNAME}.so" >> $serverPath/php/$version/etc/php.ini
|
||||
|
||||
$serverPath/php/init.d/php$version reload
|
||||
echo '==========================================================='
|
||||
echo 'successful!'
|
||||
}
|
||||
|
||||
|
||||
Uninstall_lib()
|
||||
{
|
||||
if [ ! -f "$serverPath/php/$version/bin/php-config" ];then
|
||||
echo "php-$version 未安装,请选择其它版本!"
|
||||
return
|
||||
fi
|
||||
|
||||
echo $extFile
|
||||
if [ ! -f "$extFile" ];then
|
||||
echo "php-$version 未安装${LIBNAME},请选择其它版本!"
|
||||
echo "php-$version 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
|
||||
$serverPath/php/init.d/php$version reload
|
||||
echo '==============================================='
|
||||
echo 'successful!'
|
||||
}
|
||||
|
||||
|
||||
if [ "$actionType" == 'install' ];then
|
||||
Install_lib
|
||||
elif [ "$actionType" == 'uninstall' ];then
|
||||
Uninstall_lib
|
||||
fi
|
||||
@@ -0,0 +1,95 @@
|
||||
#!/bin/bash
|
||||
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
|
||||
export PATH
|
||||
|
||||
# php 5.2.17 + eaccelerator 0.9.5.3
|
||||
# php 5.3.24 + eaccelerator 0.9.6.1
|
||||
# php 5.4.14 + eaccelerator 1.0 dev
|
||||
|
||||
|
||||
curPath=`pwd`
|
||||
rootPath=$(dirname "$curPath")
|
||||
rootPath=$(dirname "$rootPath")
|
||||
rootPath=$(dirname "$rootPath")
|
||||
rootPath=$(dirname "$rootPath")
|
||||
serverPath=$(dirname "$rootPath")
|
||||
sourcePath=${serverPath}/source/php
|
||||
|
||||
LIBNAME=eaccelerator
|
||||
LIBV=0.9.6
|
||||
sysName=`uname`
|
||||
actionType=$1
|
||||
version=$2
|
||||
extFile=$serverPath/php/${version}/lib/php/extensions/no-debug-non-zts-20090626/${LIBNAME}.so
|
||||
|
||||
Install_lib()
|
||||
{
|
||||
isInstall=`cat $serverPath/php/$version/etc/php.ini|grep "${LIBNAME}.so"`
|
||||
if [ "${isInstall}" != "" ];then
|
||||
echo "php$version 已安装${LIBNAME},请选择其它版本!"
|
||||
return
|
||||
fi
|
||||
|
||||
|
||||
if [ ! -f "$extFile" ];then
|
||||
|
||||
php_lib=$sourcePath/php_${version}_lib
|
||||
mkdir -p $php_lib
|
||||
#
|
||||
# wget -O $php_lib/${LIBNAME}-${LIBV}.tgz https://github.com/eaccelerator/eaccelerator/archive/${LIBV}.tar.gz
|
||||
wget -O $php_lib/${LIBNAME}-${LIBV}.tar.bz2 http://dl.wdlinux.cn:5180/soft/eaccelerator-0.9.6.1.tar.bz2
|
||||
|
||||
cd $php_lib && tar jxvf ${LIBNAME}-${LIBV}.tar.bz2
|
||||
cd ${LIBNAME}-${LIBV}
|
||||
$serverPath/php/$version/bin/phpize
|
||||
./configure --with-php-config=$serverPath/php/$version/bin/php-config \
|
||||
--enable-eaccelerator=shared --with-eaccelerator-shared-memory
|
||||
make && make install
|
||||
|
||||
cd $php_lib
|
||||
rm -rf ${LIBNAME}-*
|
||||
fi
|
||||
|
||||
if [ ! -f "$extFile" ];then
|
||||
echo "ERROR!"
|
||||
return
|
||||
fi
|
||||
|
||||
echo "" >> $serverPath/php/$version/etc/php.ini
|
||||
echo "[${LIBNAME}]" >> $serverPath/php/$version/etc/php.ini
|
||||
echo "extension=${LIBNAME}.so" >> $serverPath/php/$version/etc/php.ini
|
||||
|
||||
$serverPath/php/init.d/php$version reload
|
||||
echo '==========================================================='
|
||||
echo 'successful!'
|
||||
}
|
||||
|
||||
|
||||
Uninstall_lib()
|
||||
{
|
||||
if [ ! -f "$serverPath/php/$version/bin/php-config" ];then
|
||||
echo "php$version 未安装,请选择其它版本!"
|
||||
return
|
||||
fi
|
||||
|
||||
if [ ! -f "$extFile" ];then
|
||||
echo "php$version 未安装${LIBNAME},请选择其它版本!"
|
||||
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
|
||||
$serverPath/php/init.d/php$version reload
|
||||
echo '==============================================='
|
||||
echo 'successful!'
|
||||
}
|
||||
|
||||
|
||||
if [ "$actionType" == 'install' ];then
|
||||
Install_lib
|
||||
elif [ "$actionType" == 'uninstall' ];then
|
||||
Uninstall_lib
|
||||
fi
|
||||
@@ -0,0 +1,110 @@
|
||||
#!/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")
|
||||
serverPath=$(dirname "$rootPath")
|
||||
sourcePath=${serverPath}/source
|
||||
sysName=`uname`
|
||||
install_tmp=${rootPath}/tmp/mw_install.pl
|
||||
|
||||
Install_php()
|
||||
{
|
||||
#------------------------ install start ------------------------------------#
|
||||
echo "安装php-5.3.29 ..." > $install_tmp
|
||||
mkdir -p $sourcePath/php
|
||||
mkdir -p $serverPath/php
|
||||
|
||||
if [ ! -f $sourcePath/php/php-5.3.29.tar.xz ];then
|
||||
wget -O $sourcePath/php/php-5.3.29.tar.xz https://museum.php.net/php5/php-5.3.29.tar.xz
|
||||
fi
|
||||
|
||||
if [ ! -d $sourcePath/php/php-5.3.29 ];then
|
||||
cd $sourcePath/php && tar -Jxf $sourcePath/php/php-5.3.29.tar.xz
|
||||
fi
|
||||
|
||||
|
||||
|
||||
if [ -f $serverPath/php/53/bin/php.dSYM ];then
|
||||
mv $serverPath/php/53/bin/php.dSYM $serverPath/php/53/bin/php
|
||||
fi
|
||||
|
||||
if [ -f $serverPath/php/53/sbin/php-fpm.dSYM ];then
|
||||
mv $serverPath/php/53/sbin/php-fpm.dSYM $serverPath/php/53/sbin/php-fpm
|
||||
fi
|
||||
|
||||
|
||||
if [ -f $serverPath/php/53/bin/php ];then
|
||||
return
|
||||
fi
|
||||
|
||||
OPTIONS=''
|
||||
if [ $sysName == 'Darwin' ]; then
|
||||
OPTIONS='--without-iconv'
|
||||
OPTIONS="${OPTIONS} --with-curl=${serverPath}/lib/curl"
|
||||
else
|
||||
OPTIONS="--with-iconv=${serverPath}/lib/libiconv"
|
||||
OPTIONS="${OPTIONS} --with-gd --enable-gd-native-ttf"
|
||||
OPTIONS="${OPTIONS} --with-curl"
|
||||
fi
|
||||
|
||||
# --enable-intl \
|
||||
cd $sourcePath/php/php-5.3.29 && ./configure \
|
||||
--prefix=$serverPath/php/53 \
|
||||
--exec-prefix=$serverPath/php/53 \
|
||||
--with-config-file-path=$serverPath/php/53/etc \
|
||||
--with-zlib-dir=$serverPath/lib/zlib \
|
||||
--enable-zip \
|
||||
--enable-exif \
|
||||
--enable-hash \
|
||||
--enable-libxml \
|
||||
--enable-simplexml \
|
||||
--enable-dom \
|
||||
--enable-filter \
|
||||
--enable-fileinfo \
|
||||
--enable-pcntl \
|
||||
--enable-bcmath \
|
||||
--enable-xml \
|
||||
--enable-ftp \
|
||||
--enable-wddx \
|
||||
--enable-soap \
|
||||
--enable-posix \
|
||||
--enable-sockets \
|
||||
--enable-mbstring \
|
||||
--enable-mysqlnd \
|
||||
--enable-sysvmsg \
|
||||
--enable-sysvsem \
|
||||
--enable-sysvshm \
|
||||
$OPTIONS \
|
||||
--enable-fpm \
|
||||
&& make && make install && make clean
|
||||
|
||||
|
||||
if [ -f $serverPath/php/53/bin/php.dSYM ];then
|
||||
mv $serverPath/php/53/bin/php.dSYM $serverPath/php/53/bin/php
|
||||
fi
|
||||
|
||||
if [ -f $serverPath/php/53/sbin/php-fpm.dSYM ];then
|
||||
mv $serverPath/php/53/sbin/php-fpm.dSYM $serverPath/php/53/sbin/php-fpm
|
||||
fi
|
||||
|
||||
#------------------------ install end ------------------------------------#
|
||||
}
|
||||
|
||||
|
||||
|
||||
Uninstall_php()
|
||||
{
|
||||
$serverPath/php/init.d/php53 stop
|
||||
rm -rf $serverPath/php/53
|
||||
echo "uninstall php-5.3.29 ..." > $install_tmp
|
||||
}
|
||||
|
||||
action=${1}
|
||||
if [ "${1}" == 'install' ];then
|
||||
Install_php
|
||||
else
|
||||
Uninstall_php
|
||||
fi
|
||||
@@ -0,0 +1,89 @@
|
||||
#!/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=intl
|
||||
LIBV=3.0.0
|
||||
sysName=`uname`
|
||||
actionType=$1
|
||||
version=$2
|
||||
extFile=$serverPath/php/${version}/lib/php/extensions/no-debug-non-zts-20090626/${LIBNAME}.so
|
||||
|
||||
Install_lib()
|
||||
{
|
||||
isInstall=`cat $serverPath/php/$version/etc/php.ini|grep "${LIBNAME}.so"`
|
||||
if [ "${isInstall}" != "" ];then
|
||||
echo "php$version 已安装${LIBNAME},请选择其它版本!"
|
||||
return
|
||||
fi
|
||||
|
||||
|
||||
if [ ! -f "$extFile" ];then
|
||||
|
||||
php_lib=$sourcePath/php_${version}_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
|
||||
|
||||
cd $php_lib
|
||||
rm -rf ${LIBNAME}-*
|
||||
fi
|
||||
|
||||
if [ ! -f "$extFile" ];then
|
||||
echo "ERROR!"
|
||||
return
|
||||
fi
|
||||
|
||||
echo "" >> $serverPath/php/$version/etc/php.ini
|
||||
echo "[${LIBNAME}]" >> $serverPath/php/$version/etc/php.ini
|
||||
echo "extension=${LIBNAME}.so" >> $serverPath/php/$version/etc/php.ini
|
||||
|
||||
$serverPath/php/init.d/php$version reload
|
||||
echo '==========================================================='
|
||||
echo 'successful!'
|
||||
}
|
||||
|
||||
|
||||
Uninstall_lib()
|
||||
{
|
||||
if [ ! -f "$serverPath/php/$version/bin/php-config" ];then
|
||||
echo "php$version 未安装,请选择其它版本!"
|
||||
return
|
||||
fi
|
||||
|
||||
if [ ! -f "$extFile" ];then
|
||||
echo "php$version 未安装${LIBNAME},请选择其它版本!"
|
||||
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
|
||||
$serverPath/php/init.d/php$version reload
|
||||
echo '==============================================='
|
||||
echo 'successful!'
|
||||
}
|
||||
|
||||
|
||||
if [ "$actionType" == 'install' ];then
|
||||
Install_lib
|
||||
elif [ "$actionType" == 'uninstall' ];then
|
||||
Uninstall_lib
|
||||
fi
|
||||
@@ -0,0 +1,87 @@
|
||||
#!/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=memcache
|
||||
LIBV=2.2.7
|
||||
sysName=`uname`
|
||||
actionType=$1
|
||||
version=$2
|
||||
extFile=$serverPath/php/${version}/lib/php/extensions/no-debug-non-zts-20090626/${LIBNAME}.so
|
||||
|
||||
Install_lib()
|
||||
{
|
||||
isInstall=`cat $serverPath/php/$version/etc/php.ini|grep "${LIBNAME}.so"`
|
||||
if [ "${isInstall}" != "" ];then
|
||||
echo "php$version 已安装${LIBNAME},请选择其它版本!"
|
||||
return
|
||||
fi
|
||||
|
||||
if [ ! -f "$extFile" ];then
|
||||
php_lib=$sourcePath/php_${version}_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 --enable-memcache --with-zlib-dir
|
||||
make && make install
|
||||
|
||||
cd $php_lib
|
||||
rm -rf ${LIBNAME}-*
|
||||
fi
|
||||
|
||||
if [ ! -f "$extFile" ];then
|
||||
echo "ERROR!"
|
||||
return
|
||||
fi
|
||||
echo "" >> $serverPath/php/$version/etc/php.ini
|
||||
echo "[${LIBNAME}]" >> $serverPath/php/$version/etc/php.ini
|
||||
echo "extension=${LIBNAME}.so" >> $serverPath/php/$version/etc/php.ini
|
||||
|
||||
|
||||
$serverPath/php/init.d/php$version reload
|
||||
echo '==========================================================='
|
||||
echo 'successful!'
|
||||
}
|
||||
|
||||
|
||||
Uninstall_lib()
|
||||
{
|
||||
if [ ! -f "$serverPath/php/$version/bin/php-config" ];then
|
||||
echo "php-$version 未安装,请选择其它版本!"
|
||||
return
|
||||
fi
|
||||
|
||||
if [ ! -f "$extFile" ];then
|
||||
echo "php-$version 未安装${LIBNAME},请选择其它版本!"
|
||||
echo "php-$version not install memcache, 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
|
||||
$serverPath/php/init.d/php$version reload
|
||||
echo '==============================================='
|
||||
echo 'successful!'
|
||||
}
|
||||
|
||||
|
||||
if [ "$actionType" == 'install' ];then
|
||||
Install_lib
|
||||
elif [ "$actionType" == 'uninstall' ];then
|
||||
Uninstall_lib
|
||||
fi
|
||||
@@ -0,0 +1,91 @@
|
||||
#!/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=memcached
|
||||
LIBV=2.2.0
|
||||
sysName=`uname`
|
||||
actionType=$1
|
||||
version=$2
|
||||
extFile=$serverPath/php/${version}/lib/php/extensions/no-debug-non-zts-20090626/${LIBNAME}.so
|
||||
|
||||
Install_lib()
|
||||
{
|
||||
isInstall=`cat $serverPath/php/$version/etc/php.ini|grep "${LIBNAME}.so"`
|
||||
if [ "${isInstall}" != "" ];then
|
||||
echo "php$version 已安装${LIBNAME},请选择其它版本!"
|
||||
return
|
||||
fi
|
||||
|
||||
|
||||
if [ ! -f "$extFile" ];then
|
||||
|
||||
php_lib=$sourcePath/php_${version}_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 \
|
||||
--enable-memcache --with-zlib-dir=$serverPath/lib/zlib \
|
||||
--with-libmemcached-dir=$serverPath/lib/libmemcached
|
||||
make && make install
|
||||
|
||||
cd $php_lib
|
||||
rm -rf ${LIBNAME}-*
|
||||
fi
|
||||
|
||||
if [ ! -f "$extFile" ];then
|
||||
echo "ERROR!"
|
||||
return
|
||||
fi
|
||||
|
||||
echo "" >> $serverPath/php/$version/etc/php.ini
|
||||
echo "[${LIBNAME}]" >> $serverPath/php/$version/etc/php.ini
|
||||
echo "extension=${LIBNAME}.so" >> $serverPath/php/$version/etc/php.ini
|
||||
|
||||
$serverPath/php/init.d/php$version reload
|
||||
echo '==========================================================='
|
||||
echo 'successful!'
|
||||
}
|
||||
|
||||
|
||||
Uninstall_lib()
|
||||
{
|
||||
if [ ! -f "$serverPath/php/$version/bin/php-config" ];then
|
||||
echo "php-$version 未安装,请选择其它版本!"
|
||||
return
|
||||
fi
|
||||
|
||||
if [ ! -f "$extFile" ];then
|
||||
echo "php-$version 未安装${LIBNAME},请选择其它版本!"
|
||||
echo "php-$version 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
|
||||
$serverPath/php/init.d/php$version reload
|
||||
echo '==============================================='
|
||||
echo 'successful!'
|
||||
}
|
||||
|
||||
|
||||
if [ "$actionType" == 'install' ];then
|
||||
Install_lib
|
||||
elif [ "$actionType" == 'uninstall' ];then
|
||||
Uninstall_lib
|
||||
fi
|
||||
@@ -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=mongo
|
||||
LIBV=1.6.16
|
||||
sysName=`uname`
|
||||
actionType=$1
|
||||
version=$2
|
||||
extFile=$serverPath/php/${version}/lib/php/extensions/no-debug-non-zts-20090626/${LIBNAME}.so
|
||||
|
||||
Install_lib()
|
||||
{
|
||||
isInstall=`cat $serverPath/php/$version/etc/php.ini|grep "${LIBNAME}.so"`
|
||||
if [ "${isInstall}" != "" ];then
|
||||
echo "php$version 已安装${LIBNAME},请选择其它版本!"
|
||||
return
|
||||
fi
|
||||
|
||||
|
||||
if [ ! -f "$extFile" ];then
|
||||
|
||||
php_lib=$sourcePath/php_${version}_lib
|
||||
mkdir -p $php_lib
|
||||
|
||||
if [ ! -f $php_lib/${LIBNAME}-${LIBV}.tgz ];then
|
||||
wget -O $php_lib/${LIBNAME}-${LIBV}.tgz http://pecl.php.net/get/${LIBNAME}-${LIBV}.tgz
|
||||
fi
|
||||
|
||||
OPTIONS=''
|
||||
if [ $sysName == 'Darwin' ]; then
|
||||
OPTIONS="--with-openssl-dir=/usr/local/Cellar/openssl/1.0.2q"
|
||||
fi
|
||||
|
||||
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 $OPTIONS
|
||||
|
||||
make && make install
|
||||
|
||||
cd $php_lib
|
||||
rm -rf ${LIBNAME}-*
|
||||
fi
|
||||
|
||||
if [ ! -f "$extFile" ];then
|
||||
echo "ERROR!"
|
||||
return
|
||||
fi
|
||||
|
||||
echo "" >> $serverPath/php/$version/etc/php.ini
|
||||
echo "[${LIBNAME}]" >> $serverPath/php/$version/etc/php.ini
|
||||
echo "extension=${LIBNAME}.so" >> $serverPath/php/$version/etc/php.ini
|
||||
|
||||
$serverPath/php/init.d/php$version reload
|
||||
echo '==========================================================='
|
||||
echo 'successful!'
|
||||
}
|
||||
|
||||
|
||||
Uninstall_lib()
|
||||
{
|
||||
if [ ! -f "$serverPath/php/$version/bin/php-config" ];then
|
||||
echo "php$version 未安装,请选择其它版本!"
|
||||
return
|
||||
fi
|
||||
|
||||
if [ ! -f "$extFile" ];then
|
||||
echo "php$version 未安装${LIBNAME},请选择其它版本!"
|
||||
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
|
||||
$serverPath/php/init.d/php$version reload
|
||||
echo '==============================================='
|
||||
echo 'successful!'
|
||||
}
|
||||
|
||||
|
||||
if [ "$actionType" == 'install' ];then
|
||||
Install_lib
|
||||
elif [ "$actionType" == 'uninstall' ];then
|
||||
Uninstall_lib
|
||||
fi
|
||||
@@ -0,0 +1,100 @@
|
||||
#!/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=opcache
|
||||
LIBV=7.0.5
|
||||
sysName=`uname`
|
||||
actionType=$1
|
||||
version=$2
|
||||
extFile=$serverPath/php/${version}/lib/php/extensions/no-debug-non-zts-20090626/${LIBNAME}.so
|
||||
|
||||
Install_lib()
|
||||
{
|
||||
isInstall=`cat $serverPath/php/$version/etc/php.ini|grep "${LIBNAME}.so"`
|
||||
if [ "${isInstall}" != "" ];then
|
||||
echo "php$version 已安装${LIBNAME},请选择其它版本!"
|
||||
return
|
||||
fi
|
||||
|
||||
if [ ! -f "$extFile" ];then
|
||||
|
||||
php_lib=$sourcePath/php_${version}_lib
|
||||
mkdir -p $php_lib
|
||||
|
||||
wget -O $php_lib/zendopcache-7.0.5.tgz http://pecl.php.net/get/zendopcache-7.0.5.tgz
|
||||
|
||||
cd $php_lib && tar xvf zendopcache-7.0.5.tgz
|
||||
cd zendopcache-7.0.5
|
||||
$serverPath/php/$version/bin/phpize
|
||||
./configure --with-php-config=$serverPath/php/$version/bin/php-config
|
||||
make && make install
|
||||
|
||||
cd $php_lib
|
||||
rm -rf zendopcache-7.0.5
|
||||
rm -rf zendopcache-7.0.5.tgz
|
||||
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
|
||||
echo "opcache.enable=1" >> $serverPath/php/$version/etc/php.ini
|
||||
echo "opcache.memory_consumption=128" >> $serverPath/php/$version/etc/php.ini
|
||||
echo "opcache.interned_strings_buffer=8" >> $serverPath/php/$version/etc/php.ini
|
||||
echo "opcache.max_accelerated_files=4000" >> $serverPath/php/$version/etc/php.ini
|
||||
echo "opcache.revalidate_freq=60" >> $serverPath/php/$version/etc/php.ini
|
||||
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
|
||||
echo '==========================================================='
|
||||
echo 'successful!'
|
||||
}
|
||||
|
||||
|
||||
Uninstall_lib()
|
||||
{
|
||||
if [ ! -f "$serverPath/php/$version/bin/php-config" ];then
|
||||
echo "php-$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
|
||||
|
||||
if [ ! -f "$extFile" ];then
|
||||
echo "php-$version 未安装${LIBNAME},请选择其它版本!"
|
||||
echo "php-$version 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
|
||||
|
||||
$serverPath/php/init.d/php$version reload
|
||||
echo '==============================================='
|
||||
echo 'successful!'
|
||||
}
|
||||
|
||||
|
||||
if [ "$actionType" == 'install' ];then
|
||||
Install_lib
|
||||
elif [ "$actionType" == 'uninstall' ];then
|
||||
Uninstall_lib
|
||||
fi
|
||||
@@ -0,0 +1,94 @@
|
||||
#!/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=redis
|
||||
LIBV=4.2.0
|
||||
sysName=`uname`
|
||||
actionType=$1
|
||||
version=$2
|
||||
|
||||
extDir=$serverPath/php/${version}/lib/php/extensions/no-debug-non-zts-20090626/
|
||||
|
||||
Install_lib()
|
||||
{
|
||||
isInstall=`cat $serverPath/php/$version/etc/php.ini|grep "${LIBNAME}.so"`
|
||||
if [ "${isInstall}" != "" ];then
|
||||
echo "php$version 已安装${LIBNAME},请选择其它版本!"
|
||||
return
|
||||
fi
|
||||
|
||||
extFile=$extDir${LIBNAME}.so
|
||||
if [ ! -f "$extFile" ];then
|
||||
|
||||
php_lib=$sourcePath/php_${version}_lib
|
||||
mkdir -p $php_lib
|
||||
|
||||
if [ ! -f $php_lib/${LIBNAME}-${LIBV}.tgz ];then
|
||||
wget -O $php_lib/${LIBNAME}-${LIBV}.tgz http://pecl.php.net/get/${LIBNAME}-${LIBV}.tgz
|
||||
fi
|
||||
|
||||
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
|
||||
|
||||
cd $php_lib
|
||||
rm -rf ${LIBNAME}-*
|
||||
fi
|
||||
sleep 1
|
||||
if [ ! -f "$extFile" ];then
|
||||
echo "ERROR!"
|
||||
return
|
||||
fi
|
||||
|
||||
echo "" >> $serverPath/php/$version/etc/php.ini
|
||||
echo "[${LIBNAME}]" >> $serverPath/php/$version/etc/php.ini
|
||||
echo "extension=${LIBNAME}.so" >> $serverPath/php/$version/etc/php.ini
|
||||
|
||||
$serverPath/php/init.d/php$version reload
|
||||
echo '==========================================================='
|
||||
echo 'successful!'
|
||||
}
|
||||
|
||||
|
||||
Uninstall_lib()
|
||||
{
|
||||
if [ ! -f "$serverPath/php/$version/bin/php-config" ];then
|
||||
echo "php$version 未安装,请选择其它版本!"
|
||||
return
|
||||
fi
|
||||
|
||||
extFile=$extDir${LIBNAME}.so
|
||||
if [ ! -f "$extFile" ];then
|
||||
echo "php$version 未安装${LIBNAME},请选择其它版本!"
|
||||
echo "php-$vphp not install memcache, 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
|
||||
$serverPath/php/init.d/php$version reload
|
||||
echo '==============================================='
|
||||
echo 'successful!'
|
||||
}
|
||||
|
||||
|
||||
|
||||
if [ "$actionType" == 'install' ];then
|
||||
Install_lib
|
||||
elif [ "$actionType" == 'uninstall' ];then
|
||||
Uninstall_lib
|
||||
fi
|
||||
@@ -0,0 +1,100 @@
|
||||
#!/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=SeasLog
|
||||
LIBV=2.0.2
|
||||
sysName=`uname`
|
||||
actionType=$1
|
||||
version=$2
|
||||
|
||||
extDir=$serverPath/php/${version}/lib/php/extensions/no-debug-non-zts-20090626/
|
||||
|
||||
Install_lib()
|
||||
{
|
||||
isInstall=`cat $serverPath/php/$version/etc/php.ini|grep "${LIBNAME}.so"`
|
||||
if [ "${isInstall}" != "" ];then
|
||||
echo "php$version 已安装${LIBNAME},请选择其它版本!"
|
||||
return
|
||||
fi
|
||||
|
||||
extFile=$extDir${LIBNAME}.so
|
||||
if [ ! -f "$extFile" ];then
|
||||
|
||||
php_lib=$sourcePath/php_${version}_lib
|
||||
mkdir -p $php_lib
|
||||
|
||||
if [ ! -f $php_lib/${LIBNAME}-${LIBV}.tgz ];then
|
||||
wget -O $php_lib/${LIBNAME}-${LIBV}.tgz http://pecl.php.net/get/${LIBNAME}-${LIBV}.tgz
|
||||
fi
|
||||
|
||||
OPTIONS=''
|
||||
if [ $sysName == 'Darwin' ]; then
|
||||
OPTIONS="${OPTIONS} --with-curl=${serverPath}/lib/curl"
|
||||
fi
|
||||
|
||||
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
|
||||
|
||||
cd $php_lib
|
||||
rm -rf ${LIBNAME}-*
|
||||
fi
|
||||
sleep 1
|
||||
if [ ! -f "$extFile" ];then
|
||||
echo "ERROR!"
|
||||
return
|
||||
fi
|
||||
|
||||
_LIBNAME=$(echo $LIBNAME | tr '[A-Z]' '[a-z]')
|
||||
echo "" >> $serverPath/php/$version/etc/php.ini
|
||||
echo "[${_LIBNAME}]" >> $serverPath/php/$version/etc/php.ini
|
||||
echo "extension=${_LIBNAME}.so" >> $serverPath/php/$version/etc/php.ini
|
||||
|
||||
$serverPath/php/init.d/php$version reload
|
||||
echo '==========================================================='
|
||||
echo 'successful!'
|
||||
}
|
||||
|
||||
|
||||
Uninstall_lib()
|
||||
{
|
||||
if [ ! -f "$serverPath/php/$version/bin/php-config" ];then
|
||||
echo "php$version 未安装,请选择其它版本!"
|
||||
return
|
||||
fi
|
||||
|
||||
extFile=$extDir${LIBNAME}.so
|
||||
if [ ! -f "$extFile" ];then
|
||||
echo "php-$version 未安装${LIBNAME},请选择其它版本!"
|
||||
echo "php-$version not install ${LIBNAME}, Plese select other version!"
|
||||
return
|
||||
fi
|
||||
_LIBNAME=$(echo $LIBNAME | tr '[A-Z]' '[a-z]')
|
||||
sed -i '_bak' "/${_LIBNAME}.so/d" $serverPath/php/$version/etc/php.ini
|
||||
sed -i '_bak' "/${_LIBNAME}/d" $serverPath/php/$version/etc/php.ini
|
||||
|
||||
rm -f $extFile
|
||||
$serverPath/php/init.d/php$version reload
|
||||
echo '==============================================='
|
||||
echo 'successful!'
|
||||
}
|
||||
|
||||
|
||||
|
||||
if [ "$actionType" == 'install' ];then
|
||||
Install_lib
|
||||
elif [ "$actionType" == 'uninstall' ];then
|
||||
Uninstall_lib
|
||||
fi
|
||||
@@ -0,0 +1,99 @@
|
||||
#!/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=solr
|
||||
LIBV=2.4.0
|
||||
sysName=`uname`
|
||||
actionType=$1
|
||||
version=$2
|
||||
|
||||
extDir=$serverPath/php/${version}/lib/php/extensions/no-debug-non-zts-20090626/
|
||||
|
||||
Install_lib()
|
||||
{
|
||||
isInstall=`cat $serverPath/php/$version/etc/php.ini|grep "${LIBNAME}.so"`
|
||||
if [ "${isInstall}" != "" ];then
|
||||
echo "php$version 已安装${LIBNAME},请选择其它版本!"
|
||||
return
|
||||
fi
|
||||
|
||||
extFile=$extDir${LIBNAME}.so
|
||||
if [ ! -f "$extFile" ];then
|
||||
|
||||
php_lib=$sourcePath/php_${version}_lib
|
||||
mkdir -p $php_lib
|
||||
|
||||
if [ ! -f $php_lib/${LIBNAME}-${LIBV}.tgz ];then
|
||||
wget -O $php_lib/${LIBNAME}-${LIBV}.tgz http://pecl.php.net/get/${LIBNAME}-${LIBV}.tgz
|
||||
fi
|
||||
|
||||
OPTIONS=''
|
||||
if [ $sysName == 'Darwin' ]; then
|
||||
OPTIONS="${OPTIONS} --with-curl=${serverPath}/lib/curl"
|
||||
fi
|
||||
|
||||
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 $OPTIONS
|
||||
make && make install
|
||||
|
||||
cd $php_lib
|
||||
rm -rf ${LIBNAME}-*
|
||||
fi
|
||||
sleep 1
|
||||
if [ ! -f "$extFile" ];then
|
||||
echo "ERROR!"
|
||||
return
|
||||
fi
|
||||
|
||||
echo "" >> $serverPath/php/$version/etc/php.ini
|
||||
echo "[${LIBNAME}]" >> $serverPath/php/$version/etc/php.ini
|
||||
echo "extension=${LIBNAME}.so" >> $serverPath/php/$version/etc/php.ini
|
||||
|
||||
$serverPath/php/init.d/php$version reload
|
||||
echo '==========================================================='
|
||||
echo 'successful!'
|
||||
}
|
||||
|
||||
|
||||
Uninstall_lib()
|
||||
{
|
||||
if [ ! -f "$serverPath/php/$version/bin/php-config" ];then
|
||||
echo "php$version 未安装,请选择其它版本!"
|
||||
return
|
||||
fi
|
||||
|
||||
extFile=$extDir${LIBNAME}.so
|
||||
if [ ! -f "$extFile" ];then
|
||||
echo "php-$version 未安装${LIBNAME},请选择其它版本!"
|
||||
echo "php-$version 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
|
||||
$serverPath/php/init.d/php$version reload
|
||||
echo '==============================================='
|
||||
echo 'successful!'
|
||||
}
|
||||
|
||||
|
||||
|
||||
if [ "$actionType" == 'install' ];then
|
||||
Install_lib
|
||||
elif [ "$actionType" == 'uninstall' ];then
|
||||
Uninstall_lib
|
||||
fi
|
||||
@@ -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=swoole
|
||||
LIBV='1.10.1';
|
||||
if [ "$version" = '70' ] || [ "$version" = '71' ] || [ "$version" = '72' ];then
|
||||
LIBV='2.2.0'
|
||||
fi
|
||||
extFile=$serverPath/php/${version}/lib/php/extensions/no-debug-non-zts-20090626/${LIBNAME}.so
|
||||
|
||||
|
||||
Install_lib()
|
||||
{
|
||||
|
||||
isInstall=`cat $serverPath/php/$version/etc/php.ini|grep '${LIBNAME}.so'`
|
||||
if [ "${isInstall}" != "" ];then
|
||||
echo "php-$version 已安装${LIBNAME},请选择其它版本!"
|
||||
return
|
||||
fi
|
||||
|
||||
if [ ! -f "$extFile" ];then
|
||||
|
||||
php_lib=$sourcePath/php_${version}_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 \
|
||||
--enable-openssl --with-openssl-dir=$serverPath/lib/openssl --enable-sockets
|
||||
make && make install
|
||||
cd ..
|
||||
rm -rf ${LIBNAME}-*
|
||||
fi
|
||||
|
||||
while [[ ! -f "$extFile" ]];
|
||||
do
|
||||
echo -e ".\c"
|
||||
sleep 0.5
|
||||
if [ ! -f "$extFile" ];then
|
||||
echo "ERROR!"
|
||||
fi
|
||||
let n+=1
|
||||
if [ $n -gt 8 ];then
|
||||
echo "WAIT " $n "TIMES FAIL!"
|
||||
return;
|
||||
fi
|
||||
done
|
||||
|
||||
echo "" >> $serverPath/php/$version/etc/php.ini
|
||||
echo "[${LIBNAME}]" >> $serverPath/php/$version/etc/php.ini
|
||||
echo "extension=${LIBNAME}.so" >> $serverPath/php/$version/etc/php.ini
|
||||
|
||||
$serverPath/php/init.d/php$version reload
|
||||
echo '==========================================================='
|
||||
echo 'successful!'
|
||||
}
|
||||
|
||||
|
||||
Uninstall_lib()
|
||||
{
|
||||
if [ ! -f "$serverPath/php/$version/bin/php-config" ];then
|
||||
echo "php-$version 未安装,请选择其它版本!"
|
||||
return
|
||||
fi
|
||||
|
||||
if [ ! -f "$extFile" ];then
|
||||
echo "php-$version 未安装${LIBNAME},请选择其它版本!"
|
||||
echo "php-$version not install ${LIBNAME}, Plese select other version!"
|
||||
return
|
||||
fi
|
||||
|
||||
echo $serverPath/php/$version/etc/php.ini
|
||||
sed -i '_bak' "/${LIBNAME}.so/d" $serverPath/php/$version/etc/php.ini
|
||||
sed -i '_bak' "/${LIBNAME}/d" $serverPath/php/$version/etc/php.ini
|
||||
|
||||
rm -f $extFile
|
||||
$serverPath/php/init.d/php$version reload
|
||||
echo '==============================================='
|
||||
echo 'successful!'
|
||||
}
|
||||
|
||||
|
||||
|
||||
if [ "$actionType" == 'install' ];then
|
||||
Install_lib
|
||||
elif [ "$actionType" == 'uninstall' ];then
|
||||
Uninstall_lib
|
||||
fi
|
||||
@@ -0,0 +1,89 @@
|
||||
#!/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=xdebug
|
||||
LIBV=2.2.7
|
||||
sysName=`uname`
|
||||
actionType=$1
|
||||
version=$2
|
||||
extFile=$serverPath/php/${version}/lib/php/extensions/no-debug-non-zts-20090626/${LIBNAME}.so
|
||||
|
||||
Install_lib()
|
||||
{
|
||||
isInstall=`cat $serverPath/php/$version/etc/php.ini|grep "${LIBNAME}.so"`
|
||||
if [ "${isInstall}" != "" ];then
|
||||
echo "php$version 已安装${LIBNAME},请选择其它版本!"
|
||||
return
|
||||
fi
|
||||
|
||||
|
||||
if [ ! -f "$extFile" ];then
|
||||
|
||||
php_lib=$sourcePath/php_${version}_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
|
||||
|
||||
cd $php_lib
|
||||
rm -rf ${LIBNAME}-*
|
||||
fi
|
||||
|
||||
if [ ! -f "$extFile" ];then
|
||||
echo "ERROR!"
|
||||
return
|
||||
fi
|
||||
|
||||
echo "" >> $serverPath/php/$version/etc/php.ini
|
||||
echo "[${LIBNAME}]" >> $serverPath/php/$version/etc/php.ini
|
||||
echo "extension=${LIBNAME}.so" >> $serverPath/php/$version/etc/php.ini
|
||||
|
||||
$serverPath/php/init.d/php$version reload
|
||||
echo '==========================================================='
|
||||
echo 'successful!'
|
||||
}
|
||||
|
||||
|
||||
Uninstall_lib()
|
||||
{
|
||||
if [ ! -f "$serverPath/php/$version/bin/php-config" ];then
|
||||
echo "php-$version 未安装,请选择其它版本!"
|
||||
return
|
||||
fi
|
||||
|
||||
if [ ! -f "$extFile" ];then
|
||||
echo "php-$version 未安装${LIBNAME},请选择其它版本!"
|
||||
echo "php-$version 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
|
||||
$serverPath/php/init.d/php$version reload
|
||||
echo '==============================================='
|
||||
echo 'successful!'
|
||||
}
|
||||
|
||||
|
||||
if [ "$actionType" == 'install' ];then
|
||||
Install_lib
|
||||
elif [ "$actionType" == 'uninstall' ];then
|
||||
Uninstall_lib
|
||||
fi
|
||||
@@ -0,0 +1,88 @@
|
||||
#!/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=xhprof
|
||||
LIBV=0.9.4
|
||||
sysName=`uname`
|
||||
actionType=$1
|
||||
version=$2
|
||||
extFile=$serverPath/php/${version}/lib/php/extensions/no-debug-non-zts-20090626/${LIBNAME}.so
|
||||
|
||||
Install_lib()
|
||||
{
|
||||
isInstall=`cat $serverPath/php/$version/etc/php.ini|grep "${LIBNAME}.so"`
|
||||
if [ "${isInstall}" != "" ];then
|
||||
echo "php-$version 已安装${LIBNAME},请选择其它版本!"
|
||||
return
|
||||
fi
|
||||
|
||||
if [ ! -f "$extFile" ];then
|
||||
php_lib=$sourcePath/php_${version}_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}/extension
|
||||
$serverPath/php/$version/bin/phpize
|
||||
./configure --enable-xhprof --with-php-config=$serverPath/php/$version/bin/php-config
|
||||
make && make install
|
||||
|
||||
cd $php_lib
|
||||
rm -rf ${LIBNAME}-*
|
||||
fi
|
||||
|
||||
if [ ! -f "$extFile" ];then
|
||||
echo "ERROR!"
|
||||
return
|
||||
fi
|
||||
|
||||
|
||||
echo "" >> $serverPath/php/$version/etc/php.ini
|
||||
echo "[${LIBNAME}]" >> $serverPath/php/$version/etc/php.ini
|
||||
echo "extension=${LIBNAME}.so" >> $serverPath/php/$version/etc/php.ini
|
||||
|
||||
$serverPath/php/init.d/php$version reload
|
||||
echo '==========================================================='
|
||||
echo 'successful!'
|
||||
}
|
||||
|
||||
|
||||
Uninstall_lib()
|
||||
{
|
||||
if [ ! -f "$serverPath/php/$version/bin/php-config" ];then
|
||||
echo "php-$version 未安装,请选择其它版本!"
|
||||
return
|
||||
fi
|
||||
|
||||
if [ ! -f "$extFile" ];then
|
||||
echo "php-$version 未安装${LIBNAME},请选择其它版本!"
|
||||
echo "php-$version 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
|
||||
$serverPath/php/init.d/php$version reload
|
||||
echo '==============================================='
|
||||
echo 'successful!'
|
||||
}
|
||||
|
||||
|
||||
if [ "$actionType" == 'install' ];then
|
||||
Install_lib
|
||||
elif [ "$actionType" == 'uninstall' ];then
|
||||
Uninstall_lib
|
||||
fi
|
||||
@@ -0,0 +1,100 @@
|
||||
#!/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=yaf
|
||||
LIBV='2.3.5'
|
||||
|
||||
actionType=$1
|
||||
version=$2
|
||||
extFile=$serverPath/php/${version}/lib/php/extensions/no-debug-non-zts-20090626/${LIBNAME}.so
|
||||
|
||||
if [ "$version" = '70' ] || [ "$version" = '71' ] || [ "$version" = '72' ] || [ "$version" = '73' ];then
|
||||
LIBV='3.0.7';
|
||||
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_${version}_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
|
||||
cd ..
|
||||
rm -rf yaf-*
|
||||
rm -f package.xml
|
||||
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
|
||||
echo "yaf.use_namespace=1" >> $serverPath/php/$version/etc/php.ini
|
||||
|
||||
$serverPath/php/init.d/php$version reload
|
||||
echo '==========================================================='
|
||||
echo 'successful!'
|
||||
}
|
||||
|
||||
|
||||
Uninstall_lib()
|
||||
{
|
||||
if [ ! -f "$serverPath/php/$version/bin/php-config" ];then
|
||||
echo "php$version 未安装,请选择其它版本!"
|
||||
return
|
||||
fi
|
||||
|
||||
if [ ! -f "$extFile" ];then
|
||||
echo "php-$version 未安装${LIBNAME},请选择其它版本!"
|
||||
echo "php-$version not install ${LIBNAME}, Plese select other version!"
|
||||
return
|
||||
fi
|
||||
|
||||
echo $serverPath/php/$version/etc/php.ini
|
||||
sed -i '_bak' "/yaf.so/d" $serverPath/php/$version/etc/php.ini
|
||||
sed -i '_bak' "/yaf.use_namespace/d" $serverPath/php/$version/etc/php.ini
|
||||
sed -i '_bak' "/\[yaf\]/d" $serverPath/php/$version/etc/php.ini
|
||||
|
||||
rm -f $extFile
|
||||
$serverPath/php/init.d/php$version reload
|
||||
echo '==============================================='
|
||||
echo 'successful!'
|
||||
}
|
||||
|
||||
|
||||
if [ "$actionType" == 'install' ];then
|
||||
Install_lib
|
||||
elif [ "$actionType" == 'uninstall' ];then
|
||||
Uninstall_lib
|
||||
fi
|
||||
@@ -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=ZendGuardLoader
|
||||
|
||||
sysName=`uname`
|
||||
actionType=$1
|
||||
version=$2
|
||||
extFile=$serverPath/php/${version}/lib/php/extensions/no-debug-non-zts-20090626/${LIBNAME}.so
|
||||
|
||||
Install_lib()
|
||||
{
|
||||
|
||||
|
||||
isInstall=`cat $serverPath/php/$version/etc/php.ini|grep "${LIBNAME}.so"`
|
||||
if [ "${isInstall}" != "" ];then
|
||||
echo "php$version 已安装${LIBNAME},请选择其它版本!"
|
||||
return
|
||||
fi
|
||||
|
||||
if [ ! -f "$extFile" ];then
|
||||
|
||||
php_lib=$sourcePath/php_${version}_lib
|
||||
mkdir -p $php_lib
|
||||
|
||||
if [ $sysName == 'Darwin' ]; then
|
||||
wget -O $php_lib/zend-loader-php5.3.tar.gz http://downloads.zend.com/guard/5.5.0/ZendGuardLoader-php-5.3-darwin-i386.tar.gz
|
||||
else
|
||||
wget -O $php_lib/zend-loader-php5.3.tar.gz http://downloads.zend.com/guard/5.5.0/ZendGuardLoader-php-5.3-linux-glibc23-x86_64.tar.gz
|
||||
fi
|
||||
|
||||
cd $php_lib && tar xvf zend-loader-php5.3.tar.gz
|
||||
cd ZendGuardLoader-php* && cd php-5.3.x
|
||||
cp ZendGuardLoader.so $serverPath/php/$version/lib/php/extensions/no-debug-non-zts-20090626/
|
||||
|
||||
rm -rf $php_lib/ZendGuardLoader*
|
||||
rm -rf $php_lib/zend-loader-php5.3*
|
||||
fi
|
||||
|
||||
if [ ! -f "$extFile" ];then
|
||||
echo "ERROR!"
|
||||
return
|
||||
fi
|
||||
|
||||
echo "" >> $serverPath/php/$version/etc/php.ini
|
||||
echo "[Zend ZendGuard Loader]" >> $serverPath/php/$version/etc/php.ini
|
||||
echo "zend_extension=ZendGuardLoader.so" >> $serverPath/php/$version/etc/php.ini
|
||||
echo "zend_loader.enable=1" >> $serverPath/php/$version/etc/php.ini
|
||||
echo "zend_loader.disable_licensing=0" >> $serverPath/php/$version/etc/php.ini
|
||||
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
|
||||
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
|
||||
|
||||
sed -i '_bak' "/ZendGuardLoader.so/d" $serverPath/php/$version/etc/php.ini
|
||||
sed -i '_bak' "/zend_loader/d" $serverPath/php/$version/etc/php.ini
|
||||
sed -i '_bak' "/\[Zend ZendGuard Loader\]/d" $serverPath/php/$version/etc/php.ini
|
||||
|
||||
rm -f $extFile
|
||||
$serverPath/php/init.d/php$version reload
|
||||
echo '==============================================='
|
||||
echo 'successful!'
|
||||
}
|
||||
|
||||
|
||||
|
||||
if [ "$actionType" == 'install' ];then
|
||||
Install_lib
|
||||
elif [ "$actionType" == 'uninstall' ];then
|
||||
Uninstall_lib
|
||||
fi
|
||||
@@ -0,0 +1,92 @@
|
||||
#!/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=apc
|
||||
LIBV=3.1.9
|
||||
sysName=`uname`
|
||||
actionType=$1
|
||||
version=$2
|
||||
extFile=$serverPath/php/${version}/lib/php/extensions/no-debug-non-zts-20100525/${LIBNAME}.so
|
||||
|
||||
Install_lib()
|
||||
{
|
||||
isInstall=`cat $serverPath/php/$version/etc/php.ini|grep "${LIBNAME}.so"`
|
||||
if [ "${isInstall}" != "" ];then
|
||||
echo "php$version 已安装${LIBNAME},请选择其它版本!"
|
||||
return
|
||||
fi
|
||||
|
||||
if [ ! -f "$extFile" ];then
|
||||
|
||||
php_lib=$sourcePath/php_${version}_lib
|
||||
mkdir -p $php_lib
|
||||
|
||||
_LIBNAME=$(echo $LIBNAME | tr '[a-z]' '[A-Z]')
|
||||
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
|
||||
|
||||
cd $php_lib
|
||||
|
||||
rm -rf ${_LIBNAME}-${LIBV}
|
||||
rm -rf ${_LIBNAME}-${LIBV}.tgz
|
||||
fi
|
||||
|
||||
if [ ! -f "$extFile" ];then
|
||||
echo "ERROR!"
|
||||
return
|
||||
fi
|
||||
|
||||
echo "" >> $serverPath/php/$version/etc/php.ini
|
||||
echo "[${LIBNAME}]" >> $serverPath/php/$version/etc/php.ini
|
||||
echo "extension=${LIBNAME}.so" >> $serverPath/php/$version/etc/php.ini
|
||||
|
||||
$serverPath/php/init.d/php$version reload
|
||||
echo '==========================================================='
|
||||
echo 'successful!'
|
||||
}
|
||||
|
||||
|
||||
Uninstall_lib()
|
||||
{
|
||||
if [ ! -f "$serverPath/php/$version/bin/php-config" ];then
|
||||
echo "php-$version 未安装,请选择其它版本!"
|
||||
return
|
||||
fi
|
||||
|
||||
echo $extFile
|
||||
if [ ! -f "$extFile" ];then
|
||||
echo "php-$version 未安装${LIBNAME},请选择其它版本!"
|
||||
echo "php-$version 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
|
||||
$serverPath/php/init.d/php$version reload
|
||||
echo '==============================================='
|
||||
echo 'successful!'
|
||||
}
|
||||
|
||||
|
||||
if [ "$actionType" == 'install' ];then
|
||||
Install_lib
|
||||
elif [ "$actionType" == 'uninstall' ];then
|
||||
Uninstall_lib
|
||||
fi
|
||||
@@ -0,0 +1,91 @@
|
||||
#!/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=imagick
|
||||
LIBV=3.4.3
|
||||
sysName=`uname`
|
||||
actionType=$1
|
||||
version=$2
|
||||
extFile=$serverPath/php/${version}/lib/php/extensions/no-debug-non-zts-20100525/${LIBNAME}.so
|
||||
|
||||
Install_lib()
|
||||
{
|
||||
isInstall=`cat $serverPath/php/$version/etc/php.ini|grep "${LIBNAME}.so"`
|
||||
if [ "${isInstall}" != "" ];then
|
||||
echo "php$version 已安装${LIBNAME},请选择其它版本!"
|
||||
return
|
||||
fi
|
||||
|
||||
|
||||
if [ ! -f "$extFile" ];then
|
||||
|
||||
php_lib=$sourcePath/php_${version}_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 \
|
||||
--enable-memcache --with-zlib-dir=$serverPath/lib/zlib \
|
||||
--with-libmemcached-dir=$serverPath/lib/libmemcached
|
||||
make && make install
|
||||
|
||||
cd $php_lib
|
||||
rm -rf ${LIBNAME}-*
|
||||
fi
|
||||
|
||||
if [ ! -f "$extFile" ];then
|
||||
echo "ERROR!"
|
||||
return
|
||||
fi
|
||||
|
||||
echo "" >> $serverPath/php/$version/etc/php.ini
|
||||
echo "[${LIBNAME}]" >> $serverPath/php/$version/etc/php.ini
|
||||
echo "extension=${LIBNAME}.so" >> $serverPath/php/$version/etc/php.ini
|
||||
|
||||
$serverPath/php/init.d/php$version reload
|
||||
echo '==========================================================='
|
||||
echo 'successful!'
|
||||
}
|
||||
|
||||
|
||||
Uninstall_lib()
|
||||
{
|
||||
if [ ! -f "$serverPath/php/$version/bin/php-config" ];then
|
||||
echo "php-$version 未安装,请选择其它版本!"
|
||||
return
|
||||
fi
|
||||
|
||||
if [ ! -f "$extFile" ];then
|
||||
echo "php-$version 未安装${LIBNAME},请选择其它版本!"
|
||||
echo "php-$version 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
|
||||
$serverPath/php/init.d/php$version reload
|
||||
echo '==============================================='
|
||||
echo 'successful!'
|
||||
}
|
||||
|
||||
|
||||
if [ "$actionType" == 'install' ];then
|
||||
Install_lib
|
||||
elif [ "$actionType" == 'uninstall' ];then
|
||||
Uninstall_lib
|
||||
fi
|
||||
@@ -0,0 +1,77 @@
|
||||
#!/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")
|
||||
serverPath=$(dirname "$rootPath")
|
||||
sourcePath=${serverPath}/source
|
||||
sysName=`uname`
|
||||
install_tmp=${rootPath}/tmp/mw_install.pl
|
||||
|
||||
|
||||
|
||||
Install_php()
|
||||
{
|
||||
#------------------------ install start ------------------------------------#
|
||||
echo "安装php-7.2.5 ..." > $install_tmp
|
||||
mkdir -p $sourcePath/php
|
||||
mkdir -p $serverPath/php
|
||||
|
||||
if [ ! -f $sourcePath/php/php-5.4.45.tar.gz ];then
|
||||
wget -O $sourcePath/php/php-5.4.45.tar.gz https://museum.php.net/php5/php-5.4.45.tar.gz
|
||||
fi
|
||||
|
||||
if [ ! -d $sourcePath/php/php-5.4.45 ];then
|
||||
cd $sourcePath/php && tar -zvxf $sourcePath/php/php-5.4.45.tar.gz
|
||||
fi
|
||||
|
||||
|
||||
OPTIONS=''
|
||||
if [ $sysName == 'Darwin' ]; then
|
||||
OPTIONS='--without-iconv'
|
||||
OPTIONS="${OPTIONS} --with-curl=${serverPath}/lib/curl"
|
||||
else
|
||||
OPTIONS="--with-iconv=${serverPath}/lib/libiconv"
|
||||
OPTIONS="${OPTIONS} --with-gd --enable-gd-native-ttf"
|
||||
OPTIONS="${OPTIONS} --with-curl"
|
||||
fi
|
||||
|
||||
cd $sourcePath/php/php-5.4.45 && ./configure \
|
||||
--prefix=$serverPath/php/54 \
|
||||
--exec-prefix=$serverPath/php/54 \
|
||||
--with-config-file-path=$serverPath/php/54/etc \
|
||||
--with-zlib-dir=$serverPath/lib/zlib \
|
||||
--enable-mysqlnd \
|
||||
--enable-zip \
|
||||
--enable-mbstring \
|
||||
--enable-sockets \
|
||||
--enable-ftp \
|
||||
--enable-simplexml \
|
||||
--enable-wddx \
|
||||
--enable-soap \
|
||||
--enable-posix \
|
||||
--enable-sysvmsg \
|
||||
--enable-sysvsem \
|
||||
--enable-sysvshm \
|
||||
$OPTIONS \
|
||||
--enable-fpm \
|
||||
&& make && make install && make clean
|
||||
|
||||
#------------------------ install end ------------------------------------#
|
||||
}
|
||||
|
||||
Uninstall_php()
|
||||
{
|
||||
$serverPath/php/init.d/php54 stop
|
||||
rm -rf $serverPath/php/54
|
||||
echo "卸载php-5.4.45 ..." > $install_tmp
|
||||
}
|
||||
|
||||
action=${1}
|
||||
if [ "${1}" == 'install' ];then
|
||||
Install_php
|
||||
else
|
||||
Uninstall_php
|
||||
fi
|
||||
@@ -0,0 +1,87 @@
|
||||
#!/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=memcache
|
||||
LIBV=2.2.7
|
||||
sysName=`uname`
|
||||
actionType=$1
|
||||
version=$2
|
||||
extFile=$serverPath/php/${version}/lib/php/extensions/no-debug-non-zts-20100525/${LIBNAME}.so
|
||||
|
||||
Install_lib()
|
||||
{
|
||||
isInstall=`cat $serverPath/php/$version/etc/php.ini|grep "${LIBNAME}.so"`
|
||||
if [ "${isInstall}" != "" ];then
|
||||
echo "php$version 已安装${LIBNAME},请选择其它版本!"
|
||||
return
|
||||
fi
|
||||
|
||||
if [ ! -f "$extFile" ];then
|
||||
php_lib=$sourcePath/php_${version}_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 --enable-memcache --with-zlib-dir
|
||||
make && make install
|
||||
|
||||
cd $php_lib
|
||||
rm -rf ${LIBNAME}-*
|
||||
fi
|
||||
|
||||
if [ ! -f "$extFile" ];then
|
||||
echo "ERROR!"
|
||||
return
|
||||
fi
|
||||
|
||||
echo "" >> $serverPath/php/$version/etc/php.ini
|
||||
echo "[${LIBNAME}]" >> $serverPath/php/$version/etc/php.ini
|
||||
echo "extension=${LIBNAME}.so" >> $serverPath/php/$version/etc/php.ini
|
||||
|
||||
$serverPath/php/init.d/php$version reload
|
||||
echo '==========================================================='
|
||||
echo 'successful!'
|
||||
}
|
||||
|
||||
|
||||
Uninstall_lib()
|
||||
{
|
||||
if [ ! -f "$serverPath/php/$version/bin/php-config" ];then
|
||||
echo "php-$version 未安装,请选择其它版本!"
|
||||
return
|
||||
fi
|
||||
|
||||
if [ ! -f "$extFile" ];then
|
||||
echo "php-$version 未安装${LIBNAME},请选择其它版本!"
|
||||
echo "php-$version not install memcache, 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
|
||||
$serverPath/php/init.d/php$version reload
|
||||
echo '==============================================='
|
||||
echo 'successful!'
|
||||
}
|
||||
|
||||
|
||||
if [ "$actionType" == 'install' ];then
|
||||
Install_lib
|
||||
elif [ "$actionType" == 'uninstall' ];then
|
||||
Uninstall_lib
|
||||
fi
|
||||
@@ -0,0 +1,91 @@
|
||||
#!/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=memcached
|
||||
LIBV=2.2.0
|
||||
sysName=`uname`
|
||||
actionType=$1
|
||||
version=$2
|
||||
extFile=$serverPath/php/${version}/lib/php/extensions/no-debug-non-zts-20100525/${LIBNAME}.so
|
||||
|
||||
Install_lib()
|
||||
{
|
||||
isInstall=`cat $serverPath/php/$version/etc/php.ini|grep "${LIBNAME}.so"`
|
||||
if [ "${isInstall}" != "" ];then
|
||||
echo "php$version 已安装${LIBNAME},请选择其它版本!"
|
||||
return
|
||||
fi
|
||||
|
||||
|
||||
if [ ! -f "$extFile" ];then
|
||||
|
||||
php_lib=$sourcePath/php_${version}_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 \
|
||||
--enable-memcache --with-zlib-dir=$serverPath/lib/zlib \
|
||||
--with-libmemcached-dir=$serverPath/lib/libmemcached
|
||||
make && make install
|
||||
|
||||
cd $php_lib
|
||||
rm -rf ${LIBNAME}-*
|
||||
fi
|
||||
|
||||
if [ ! -f "$extFile" ];then
|
||||
echo "ERROR!"
|
||||
return
|
||||
fi
|
||||
|
||||
echo "" >> $serverPath/php/$version/etc/php.ini
|
||||
echo "[${LIBNAME}]" >> $serverPath/php/$version/etc/php.ini
|
||||
echo "extension=${LIBNAME}.so" >> $serverPath/php/$version/etc/php.ini
|
||||
|
||||
$serverPath/php/init.d/php$version reload
|
||||
echo '==========================================================='
|
||||
echo 'successful!'
|
||||
}
|
||||
|
||||
|
||||
Uninstall_lib()
|
||||
{
|
||||
if [ ! -f "$serverPath/php/$version/bin/php-config" ];then
|
||||
echo "php-$version 未安装,请选择其它版本!"
|
||||
return
|
||||
fi
|
||||
|
||||
if [ ! -f "$extFile" ];then
|
||||
echo "php-$version 未安装${LIBNAME},请选择其它版本!"
|
||||
echo "php-$version 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
|
||||
$serverPath/php/init.d/php$version reload
|
||||
echo '==============================================='
|
||||
echo 'successful!'
|
||||
}
|
||||
|
||||
|
||||
if [ "$actionType" == 'install' ];then
|
||||
Install_lib
|
||||
elif [ "$actionType" == 'uninstall' ];then
|
||||
Uninstall_lib
|
||||
fi
|
||||
@@ -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=mongo
|
||||
LIBV=1.6.16
|
||||
sysName=`uname`
|
||||
actionType=$1
|
||||
version=$2
|
||||
extFile=$serverPath/php/${version}/lib/php/extensions/no-debug-non-zts-20100525/${LIBNAME}.so
|
||||
|
||||
Install_lib()
|
||||
{
|
||||
isInstall=`cat $serverPath/php/$version/etc/php.ini|grep "${LIBNAME}.so"`
|
||||
if [ "${isInstall}" != "" ];then
|
||||
echo "php$version 已安装${LIBNAME},请选择其它版本!"
|
||||
return
|
||||
fi
|
||||
|
||||
|
||||
if [ ! -f "$extFile" ];then
|
||||
|
||||
php_lib=$sourcePath/php_${version}_lib
|
||||
mkdir -p $php_lib
|
||||
|
||||
if [ ! -f $php_lib/${LIBNAME}-${LIBV}.tgz ];then
|
||||
wget -O $php_lib/${LIBNAME}-${LIBV}.tgz http://pecl.php.net/get/${LIBNAME}-${LIBV}.tgz
|
||||
fi
|
||||
|
||||
OPTIONS=''
|
||||
if [ $sysName == 'Darwin' ]; then
|
||||
OPTIONS="--with-openssl-dir=/usr/local/Cellar/openssl/1.0.2q"
|
||||
fi
|
||||
|
||||
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 $OPTIONS
|
||||
|
||||
make && make install
|
||||
|
||||
cd $php_lib
|
||||
rm -rf ${LIBNAME}-*
|
||||
fi
|
||||
|
||||
if [ ! -f "$extFile" ];then
|
||||
echo "ERROR!"
|
||||
return
|
||||
fi
|
||||
|
||||
echo "" >> $serverPath/php/$version/etc/php.ini
|
||||
echo "[${LIBNAME}]" >> $serverPath/php/$version/etc/php.ini
|
||||
echo "extension=${LIBNAME}.so" >> $serverPath/php/$version/etc/php.ini
|
||||
|
||||
$serverPath/php/init.d/php$version reload
|
||||
echo '==========================================================='
|
||||
echo 'successful!'
|
||||
}
|
||||
|
||||
|
||||
Uninstall_lib()
|
||||
{
|
||||
if [ ! -f "$serverPath/php/$version/bin/php-config" ];then
|
||||
echo "php$version 未安装,请选择其它版本!"
|
||||
return
|
||||
fi
|
||||
|
||||
if [ ! -f "$extFile" ];then
|
||||
echo "php$version 未安装${LIBNAME},请选择其它版本!"
|
||||
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
|
||||
$serverPath/php/init.d/php$version reload
|
||||
echo '==============================================='
|
||||
echo 'successful!'
|
||||
}
|
||||
|
||||
|
||||
if [ "$actionType" == 'install' ];then
|
||||
Install_lib
|
||||
elif [ "$actionType" == 'uninstall' ];then
|
||||
Uninstall_lib
|
||||
fi
|
||||
@@ -0,0 +1,103 @@
|
||||
#!/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=opcache
|
||||
LIBV=7.0.5
|
||||
sysName=`uname`
|
||||
actionType=$1
|
||||
version=$2
|
||||
extFile=$serverPath/php/${version}/lib/php/extensions/no-debug-non-zts-20100525/${LIBNAME}.so
|
||||
|
||||
Install_lib()
|
||||
{
|
||||
isInstall=`cat $serverPath/php/$version/etc/php.ini|grep "${LIBNAME}.so"`
|
||||
if [ "${isInstall}" != "" ];then
|
||||
echo "php$version 已安装${LIBNAME},请选择其它版本!"
|
||||
return
|
||||
fi
|
||||
|
||||
if [ ! -f "$extFile" ];then
|
||||
|
||||
php_lib=$sourcePath/php_${version}_lib
|
||||
mkdir -p $php_lib
|
||||
|
||||
wget -O $php_lib/zendopcache-7.0.5.tgz http://pecl.php.net/get/zendopcache-7.0.5.tgz
|
||||
|
||||
cd $php_lib && tar xvf zendopcache-7.0.5.tgz
|
||||
cd zendopcache-7.0.5
|
||||
$serverPath/php/$version/bin/phpize
|
||||
./configure --with-php-config=$serverPath/php/$version/bin/php-config
|
||||
make && make install
|
||||
|
||||
# cp modules/opcache.la $serverPath/php/${version}/lib/php/extensions/no-debug-non-zts-20100525/
|
||||
|
||||
cd $php_lib
|
||||
rm -rf zendopcache-7.0.5
|
||||
rm -rf zendopcache-7.0.5.tgz
|
||||
rm -rf package.xml
|
||||
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
|
||||
echo "opcache.enable=1" >> $serverPath/php/$version/etc/php.ini
|
||||
echo "opcache.memory_consumption=128" >> $serverPath/php/$version/etc/php.ini
|
||||
echo "opcache.interned_strings_buffer=8" >> $serverPath/php/$version/etc/php.ini
|
||||
echo "opcache.max_accelerated_files=4000" >> $serverPath/php/$version/etc/php.ini
|
||||
echo "opcache.revalidate_freq=60" >> $serverPath/php/$version/etc/php.ini
|
||||
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
|
||||
echo '==========================================================='
|
||||
echo 'successful!'
|
||||
}
|
||||
|
||||
|
||||
Uninstall_lib()
|
||||
{
|
||||
if [ ! -f "$serverPath/php/$version/bin/php-config" ];then
|
||||
echo "php-$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
|
||||
|
||||
if [ ! -f "$extFile" ];then
|
||||
echo "php-$version 未安装${LIBNAME},请选择其它版本!"
|
||||
echo "php-$version 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
|
||||
|
||||
$serverPath/php/init.d/php$version reload
|
||||
echo '==============================================='
|
||||
echo 'successful!'
|
||||
}
|
||||
|
||||
|
||||
if [ "$actionType" == 'install' ];then
|
||||
Install_lib
|
||||
elif [ "$actionType" == 'uninstall' ];then
|
||||
Uninstall_lib
|
||||
fi
|
||||
@@ -0,0 +1,93 @@
|
||||
#!/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=redis
|
||||
LIBV=4.2.0
|
||||
sysName=`uname`
|
||||
actionType=$1
|
||||
version=$2
|
||||
|
||||
extDir=$serverPath/php/${version}/lib/php/extensions/no-debug-non-zts-20100525/
|
||||
|
||||
Install_lib()
|
||||
{
|
||||
isInstall=`cat $serverPath/php/$version/etc/php.ini|grep "${LIBNAME}.so"`
|
||||
if [ "${isInstall}" != "" ];then
|
||||
echo "php$version 已安装${LIBNAME},请选择其它版本!"
|
||||
return
|
||||
fi
|
||||
|
||||
extFile=$extDir${LIBNAME}.so
|
||||
if [ ! -f "$extFile" ];then
|
||||
|
||||
php_lib=$sourcePath/php_${version}_lib
|
||||
mkdir -p $php_lib
|
||||
|
||||
if [ ! -f $php_lib/${LIBNAME}-${LIBV}.tgz ];then
|
||||
wget -O $php_lib/${LIBNAME}-${LIBV}.tgz http://pecl.php.net/get/${LIBNAME}-${LIBV}.tgz
|
||||
fi
|
||||
|
||||
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
|
||||
|
||||
cd $php_lib
|
||||
rm -rf ${LIBNAME}-*
|
||||
fi
|
||||
sleep 1
|
||||
if [ ! -f "$extFile" ];then
|
||||
echo "ERROR!"
|
||||
return
|
||||
fi
|
||||
|
||||
echo "[${LIBNAME}]" >> $serverPath/php/$version/etc/php.ini
|
||||
echo "extension=${LIBNAME}.so" >> $serverPath/php/$version/etc/php.ini
|
||||
|
||||
$serverPath/php/init.d/php$version reload
|
||||
echo '==========================================================='
|
||||
echo 'successful!'
|
||||
}
|
||||
|
||||
|
||||
Uninstall_lib()
|
||||
{
|
||||
if [ ! -f "$serverPath/php/$version/bin/php-config" ];then
|
||||
echo "php$version 未安装,请选择其它版本!"
|
||||
return
|
||||
fi
|
||||
|
||||
extFile=$extDir${LIBNAME}.so
|
||||
if [ ! -f "$extFile" ];then
|
||||
echo "php$version 未安装${LIBNAME},请选择其它版本!"
|
||||
echo "php-$vphp not install memcache, 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
|
||||
$serverPath/php/init.d/php$version reload
|
||||
echo '==============================================='
|
||||
echo 'successful!'
|
||||
}
|
||||
|
||||
|
||||
|
||||
if [ "$actionType" == 'install' ];then
|
||||
Install_lib
|
||||
elif [ "$actionType" == 'uninstall' ];then
|
||||
Uninstall_lib
|
||||
fi
|
||||
@@ -0,0 +1,100 @@
|
||||
#!/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=SeasLog
|
||||
LIBV=2.0.2
|
||||
sysName=`uname`
|
||||
actionType=$1
|
||||
version=$2
|
||||
|
||||
extDir=$serverPath/php/${version}/lib/php/extensions/no-debug-non-zts-20100525/
|
||||
|
||||
Install_lib()
|
||||
{
|
||||
isInstall=`cat $serverPath/php/$version/etc/php.ini|grep "${LIBNAME}.so"`
|
||||
if [ "${isInstall}" != "" ];then
|
||||
echo "php$version 已安装${LIBNAME},请选择其它版本!"
|
||||
return
|
||||
fi
|
||||
|
||||
extFile=$extDir${LIBNAME}.so
|
||||
if [ ! -f "$extFile" ];then
|
||||
|
||||
php_lib=$sourcePath/php_${version}_lib
|
||||
mkdir -p $php_lib
|
||||
|
||||
if [ ! -f $php_lib/${LIBNAME}-${LIBV}.tgz ];then
|
||||
wget -O $php_lib/${LIBNAME}-${LIBV}.tgz http://pecl.php.net/get/${LIBNAME}-${LIBV}.tgz
|
||||
fi
|
||||
|
||||
OPTIONS=''
|
||||
if [ $sysName == 'Darwin' ]; then
|
||||
OPTIONS="${OPTIONS} --with-curl=${serverPath}/lib/curl"
|
||||
fi
|
||||
|
||||
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
|
||||
|
||||
cd $php_lib
|
||||
rm -rf ${LIBNAME}-*
|
||||
fi
|
||||
sleep 1
|
||||
if [ ! -f "$extFile" ];then
|
||||
echo "ERROR!"
|
||||
return
|
||||
fi
|
||||
|
||||
_LIBNAME=$(echo $LIBNAME | tr '[A-Z]' '[a-z]')
|
||||
echo "" >> $serverPath/php/$version/etc/php.ini
|
||||
echo "[${_LIBNAME}]" >> $serverPath/php/$version/etc/php.ini
|
||||
echo "extension=${_LIBNAME}.so" >> $serverPath/php/$version/etc/php.ini
|
||||
|
||||
$serverPath/php/init.d/php$version reload
|
||||
echo '==========================================================='
|
||||
echo 'successful!'
|
||||
}
|
||||
|
||||
|
||||
Uninstall_lib()
|
||||
{
|
||||
if [ ! -f "$serverPath/php/$version/bin/php-config" ];then
|
||||
echo "php$version 未安装,请选择其它版本!"
|
||||
return
|
||||
fi
|
||||
|
||||
extFile=$extDir${LIBNAME}.so
|
||||
if [ ! -f "$extFile" ];then
|
||||
echo "php-$version 未安装${LIBNAME},请选择其它版本!"
|
||||
echo "php-$version not install ${LIBNAME}, Plese select other version!"
|
||||
return
|
||||
fi
|
||||
_LIBNAME=$(echo $LIBNAME | tr '[A-Z]' '[a-z]')
|
||||
sed -i '_bak' "/${_LIBNAME}.so/d" $serverPath/php/$version/etc/php.ini
|
||||
sed -i '_bak' "/${_LIBNAME}/d" $serverPath/php/$version/etc/php.ini
|
||||
|
||||
rm -f $extFile
|
||||
$serverPath/php/init.d/php$version reload
|
||||
echo '==============================================='
|
||||
echo 'successful!'
|
||||
}
|
||||
|
||||
|
||||
|
||||
if [ "$actionType" == 'install' ];then
|
||||
Install_lib
|
||||
elif [ "$actionType" == 'uninstall' ];then
|
||||
Uninstall_lib
|
||||
fi
|
||||
@@ -0,0 +1,99 @@
|
||||
#!/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=solr
|
||||
LIBV=2.4.0
|
||||
sysName=`uname`
|
||||
actionType=$1
|
||||
version=$2
|
||||
|
||||
extDir=$serverPath/php/${version}/lib/php/extensions/no-debug-non-zts-20100525/
|
||||
|
||||
Install_lib()
|
||||
{
|
||||
isInstall=`cat $serverPath/php/$version/etc/php.ini|grep "${LIBNAME}.so"`
|
||||
if [ "${isInstall}" != "" ];then
|
||||
echo "php$version 已安装${LIBNAME},请选择其它版本!"
|
||||
return
|
||||
fi
|
||||
|
||||
extFile=$extDir${LIBNAME}.so
|
||||
if [ ! -f "$extFile" ];then
|
||||
|
||||
php_lib=$sourcePath/php_${version}_lib
|
||||
mkdir -p $php_lib
|
||||
|
||||
if [ ! -f $php_lib/${LIBNAME}-${LIBV}.tgz ];then
|
||||
wget -O $php_lib/${LIBNAME}-${LIBV}.tgz http://pecl.php.net/get/${LIBNAME}-${LIBV}.tgz
|
||||
fi
|
||||
|
||||
OPTIONS=''
|
||||
if [ $sysName == 'Darwin' ]; then
|
||||
OPTIONS="${OPTIONS} --with-curl=${serverPath}/lib/curl"
|
||||
fi
|
||||
|
||||
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 $OPTIONS
|
||||
make && make install
|
||||
|
||||
cd $php_lib
|
||||
rm -rf ${LIBNAME}-*
|
||||
fi
|
||||
sleep 1
|
||||
if [ ! -f "$extFile" ];then
|
||||
echo "ERROR!"
|
||||
return
|
||||
fi
|
||||
|
||||
echo "" >> $serverPath/php/$version/etc/php.ini
|
||||
echo "[${LIBNAME}]" >> $serverPath/php/$version/etc/php.ini
|
||||
echo "extension=${LIBNAME}.so" >> $serverPath/php/$version/etc/php.ini
|
||||
|
||||
$serverPath/php/init.d/php$version reload
|
||||
echo '==========================================================='
|
||||
echo 'successful!'
|
||||
}
|
||||
|
||||
|
||||
Uninstall_lib()
|
||||
{
|
||||
if [ ! -f "$serverPath/php/$version/bin/php-config" ];then
|
||||
echo "php$version 未安装,请选择其它版本!"
|
||||
return
|
||||
fi
|
||||
|
||||
extFile=$extDir${LIBNAME}.so
|
||||
if [ ! -f "$extFile" ];then
|
||||
echo "php$version 未安装${LIBNAME},请选择其它版本!"
|
||||
echo "php-$vphp not install memcache, 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
|
||||
$serverPath/php/init.d/php$version reload
|
||||
echo '==============================================='
|
||||
echo 'successful!'
|
||||
}
|
||||
|
||||
|
||||
|
||||
if [ "$actionType" == 'install' ];then
|
||||
Install_lib
|
||||
elif [ "$actionType" == 'uninstall' ];then
|
||||
Uninstall_lib
|
||||
fi
|
||||
@@ -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=swoole
|
||||
LIBV='1.10.1';
|
||||
if [ "$version" = '70' ] || [ "$version" = '71' ] || [ "$version" = '72' ];then
|
||||
LIBV='2.2.0'
|
||||
fi
|
||||
extFile=$serverPath/php/${version}/lib/php/extensions/no-debug-non-zts-20100525/${LIBNAME}.so
|
||||
|
||||
|
||||
Install_lib()
|
||||
{
|
||||
|
||||
isInstall=`cat $serverPath/php/$version/etc/php.ini|grep '${LIBNAME}.so'`
|
||||
if [ "${isInstall}" != "" ];then
|
||||
echo "php-$version 已安装${LIBNAME},请选择其它版本!"
|
||||
return
|
||||
fi
|
||||
|
||||
if [ ! -f "$extFile" ];then
|
||||
|
||||
php_lib=$sourcePath/php_${version}_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 \
|
||||
--enable-openssl --with-openssl-dir=$serverPath/lib/openssl --enable-sockets
|
||||
make && make install
|
||||
cd ..
|
||||
rm -rf ${LIBNAME}-*
|
||||
fi
|
||||
|
||||
while [[ ! -f "$extFile" ]];
|
||||
do
|
||||
echo -e ".\c"
|
||||
sleep 0.5
|
||||
if [ ! -f "$extFile" ];then
|
||||
echo "ERROR!"
|
||||
fi
|
||||
let n+=1
|
||||
if [ $n -gt 8 ];then
|
||||
echo "WAIT " $n "TIMES FAIL!"
|
||||
return;
|
||||
fi
|
||||
done
|
||||
|
||||
echo "" >> $serverPath/php/$version/etc/php.ini
|
||||
echo "[${LIBNAME}]" >> $serverPath/php/$version/etc/php.ini
|
||||
echo "extension=${LIBNAME}.so" >> $serverPath/php/$version/etc/php.ini
|
||||
|
||||
$serverPath/php/init.d/php$version reload
|
||||
echo '==========================================================='
|
||||
echo 'successful!'
|
||||
}
|
||||
|
||||
|
||||
Uninstall_lib()
|
||||
{
|
||||
if [ ! -f "$serverPath/php/$version/bin/php-config" ];then
|
||||
echo "php-$version 未安装,请选择其它版本!"
|
||||
return
|
||||
fi
|
||||
|
||||
if [ ! -f "$extFile" ];then
|
||||
echo "php-$version 未安装${LIBNAME},请选择其它版本!"
|
||||
return
|
||||
fi
|
||||
|
||||
echo $serverPath/php/$version/etc/php.ini
|
||||
sed -i '_bak' "/${LIBNAME}.so/d" $serverPath/php/$version/etc/php.ini
|
||||
sed -i '_bak' "/${LIBNAME}/d" $serverPath/php/$version/etc/php.ini
|
||||
|
||||
rm -f $extFile
|
||||
$serverPath/php/init.d/php$version reload
|
||||
echo '==============================================='
|
||||
echo 'successful!'
|
||||
}
|
||||
|
||||
|
||||
|
||||
if [ "$actionType" == 'install' ];then
|
||||
Install_lib
|
||||
elif [ "$actionType" == 'uninstall' ];then
|
||||
Uninstall_lib
|
||||
fi
|
||||
@@ -0,0 +1,91 @@
|
||||
#!/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=xdebug
|
||||
LIBV=2.2.7
|
||||
sysName=`uname`
|
||||
actionType=$1
|
||||
version=$2
|
||||
extFile=$serverPath/php/${version}/lib/php/extensions/no-debug-non-zts-20100525/${LIBNAME}.so
|
||||
|
||||
Install_lib()
|
||||
{
|
||||
isInstall=`cat $serverPath/php/$version/etc/php.ini|grep "${LIBNAME}.so"`
|
||||
if [ "${isInstall}" != "" ];then
|
||||
echo "php$version 已安装${LIBNAME},请选择其它版本!"
|
||||
return
|
||||
fi
|
||||
|
||||
|
||||
if [ ! -f "$extFile" ];then
|
||||
|
||||
php_lib=$sourcePath/php_${version}_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 \
|
||||
--enable-memcache --with-zlib-dir=$serverPath/lib/zlib \
|
||||
--with-libmemcached-dir=$serverPath/lib/libmemcached
|
||||
make && make install
|
||||
|
||||
cd $php_lib
|
||||
rm -rf ${LIBNAME}-*
|
||||
fi
|
||||
|
||||
if [ ! -f "$extFile" ];then
|
||||
echo "ERROR!"
|
||||
return
|
||||
fi
|
||||
|
||||
echo "" >> $serverPath/php/$version/etc/php.ini
|
||||
echo "[${LIBNAME}]" >> $serverPath/php/$version/etc/php.ini
|
||||
echo "extension=${LIBNAME}.so" >> $serverPath/php/$version/etc/php.ini
|
||||
|
||||
$serverPath/php/init.d/php$version reload
|
||||
echo '==========================================================='
|
||||
echo 'successful!'
|
||||
}
|
||||
|
||||
|
||||
Uninstall_lib()
|
||||
{
|
||||
if [ ! -f "$serverPath/php/$version/bin/php-config" ];then
|
||||
echo "php-$version 未安装,请选择其它版本!"
|
||||
return
|
||||
fi
|
||||
|
||||
if [ ! -f "$extFile" ];then
|
||||
echo "php-$version 未安装${LIBNAME},请选择其它版本!"
|
||||
echo "php-$version 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
|
||||
$serverPath/php/init.d/php$version reload
|
||||
echo '==============================================='
|
||||
echo 'successful!'
|
||||
}
|
||||
|
||||
|
||||
if [ "$actionType" == 'install' ];then
|
||||
Install_lib
|
||||
elif [ "$actionType" == 'uninstall' ];then
|
||||
Uninstall_lib
|
||||
fi
|
||||
@@ -0,0 +1,88 @@
|
||||
#!/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=xhprof
|
||||
LIBV=0.9.4
|
||||
sysName=`uname`
|
||||
actionType=$1
|
||||
version=$2
|
||||
extFile=$serverPath/php/${version}/lib/php/extensions/no-debug-non-zts-20100525/${LIBNAME}.so
|
||||
|
||||
Install_lib()
|
||||
{
|
||||
isInstall=`cat $serverPath/php/$version/etc/php.ini|grep "${LIBNAME}.so"`
|
||||
if [ "${isInstall}" != "" ];then
|
||||
echo "php-$version 已安装${LIBNAME},请选择其它版本!"
|
||||
return
|
||||
fi
|
||||
|
||||
if [ ! -f "$extFile" ];then
|
||||
php_lib=$sourcePath/php_${version}_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}/extension
|
||||
$serverPath/php/$version/bin/phpize
|
||||
./configure --enable-xhprof --with-php-config=$serverPath/php/$version/bin/php-config
|
||||
make && make install
|
||||
|
||||
cd $php_lib
|
||||
rm -rf ${LIBNAME}-*
|
||||
fi
|
||||
|
||||
if [ ! -f "$extFile" ];then
|
||||
echo "ERROR!"
|
||||
return
|
||||
fi
|
||||
|
||||
|
||||
echo "" >> $serverPath/php/$version/etc/php.ini
|
||||
echo "[${LIBNAME}]" >> $serverPath/php/$version/etc/php.ini
|
||||
echo "extension=${LIBNAME}.so" >> $serverPath/php/$version/etc/php.ini
|
||||
|
||||
$serverPath/php/init.d/php$version reload
|
||||
echo '==========================================================='
|
||||
echo 'successful!'
|
||||
}
|
||||
|
||||
|
||||
Uninstall_lib()
|
||||
{
|
||||
if [ ! -f "$serverPath/php/$version/bin/php-config" ];then
|
||||
echo "php-$version 未安装,请选择其它版本!"
|
||||
return
|
||||
fi
|
||||
|
||||
if [ ! -f "$extFile" ];then
|
||||
echo "php-$version 未安装${LIBNAME},请选择其它版本!"
|
||||
echo "php-$version 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
|
||||
$serverPath/php/init.d/php$version reload
|
||||
echo '==============================================='
|
||||
echo 'successful!'
|
||||
}
|
||||
|
||||
|
||||
if [ "$actionType" == 'install' ];then
|
||||
Install_lib
|
||||
elif [ "$actionType" == 'uninstall' ];then
|
||||
Uninstall_lib
|
||||
fi
|
||||
@@ -0,0 +1,99 @@
|
||||
#!/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=yaf
|
||||
LIBV='2.3.5'
|
||||
|
||||
actionType=$1
|
||||
version=$2
|
||||
extFile=$serverPath/php/${version}/lib/php/extensions/no-debug-non-zts-20100525/${LIBNAME}.so
|
||||
|
||||
if [ "$version" = '70' ] || [ "$version" = '71' ] || [ "$version" = '72' ] || [ "$version" = '73' ];then
|
||||
LIBV='3.0.7';
|
||||
fi
|
||||
|
||||
Install_lib()
|
||||
{
|
||||
|
||||
isInstall=`cat $serverPath/php/$version/etc/php.ini|grep "${LIBNAME}.so"`
|
||||
if [ "${isInstall}" != "" ];then
|
||||
echo "php-$version 已安装yaf,请选择其它版本!"
|
||||
return
|
||||
fi
|
||||
|
||||
if [ ! -f "$extFile" ];then
|
||||
|
||||
|
||||
|
||||
php_lib=$sourcePath/php_${version}_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
|
||||
cd ..
|
||||
rm -rf yaf-*
|
||||
rm -f package.xml
|
||||
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
|
||||
echo "yaf.use_namespace=1" >> $serverPath/php/$version/etc/php.ini
|
||||
|
||||
$serverPath/php/init.d/php$version reload
|
||||
echo '==========================================================='
|
||||
echo 'successful!'
|
||||
}
|
||||
|
||||
|
||||
Uninstall_lib()
|
||||
{
|
||||
if [ ! -f "$serverPath/php/$version/bin/php-config" ];then
|
||||
echo "php$version 未安装,请选择其它版本!"
|
||||
return
|
||||
fi
|
||||
|
||||
if [ ! -f "$extFile" ];then
|
||||
echo "php$version 未安装yaf,请选择其它版本!"
|
||||
return
|
||||
fi
|
||||
|
||||
echo $serverPath/php/$version/etc/php.ini
|
||||
sed -i '_bak' "/yaf.so/d" $serverPath/php/$version/etc/php.ini
|
||||
sed -i '_bak' "/yaf.use_namespace/d" $serverPath/php/$version/etc/php.ini
|
||||
sed -i '_bak' "/\[yaf\]/d" $serverPath/php/$version/etc/php.ini
|
||||
|
||||
rm -f $extFile
|
||||
$serverPath/php/init.d/php$version reload
|
||||
echo '==============================================='
|
||||
echo 'successful!'
|
||||
}
|
||||
|
||||
|
||||
if [ "$actionType" == 'install' ];then
|
||||
Install_lib
|
||||
elif [ "$actionType" == 'uninstall' ];then
|
||||
Uninstall_lib
|
||||
fi
|
||||
@@ -0,0 +1,91 @@
|
||||
#!/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=imagick
|
||||
LIBV=3.4.3
|
||||
sysName=`uname`
|
||||
actionType=$1
|
||||
version=$2
|
||||
extFile=$serverPath/php/${version}/lib/php/extensions/no-debug-non-zts-20121212/${LIBNAME}.so
|
||||
|
||||
Install_lib()
|
||||
{
|
||||
isInstall=`cat $serverPath/php/$version/etc/php.ini|grep "${LIBNAME}.so"`
|
||||
if [ "${isInstall}" != "" ];then
|
||||
echo "php$version 已安装${LIBNAME},请选择其它版本!"
|
||||
return
|
||||
fi
|
||||
|
||||
|
||||
if [ ! -f "$extFile" ];then
|
||||
|
||||
php_lib=$sourcePath/php_${version}_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 \
|
||||
--enable-memcache --with-zlib-dir=$serverPath/lib/zlib \
|
||||
--with-libmemcached-dir=$serverPath/lib/libmemcached
|
||||
make && make install
|
||||
|
||||
cd $php_lib
|
||||
rm -rf ${LIBNAME}-*
|
||||
fi
|
||||
|
||||
if [ ! -f "$extFile" ];then
|
||||
echo "ERROR!"
|
||||
return
|
||||
fi
|
||||
|
||||
echo "" >> $serverPath/php/$version/etc/php.ini
|
||||
echo "[${LIBNAME}]" >> $serverPath/php/$version/etc/php.ini
|
||||
echo "extension=${LIBNAME}.so" >> $serverPath/php/$version/etc/php.ini
|
||||
|
||||
$serverPath/php/init.d/php$version reload
|
||||
echo '==========================================================='
|
||||
echo 'successful!'
|
||||
}
|
||||
|
||||
|
||||
Uninstall_lib()
|
||||
{
|
||||
if [ ! -f "$serverPath/php/$version/bin/php-config" ];then
|
||||
echo "php-$version 未安装,请选择其它版本!"
|
||||
return
|
||||
fi
|
||||
|
||||
if [ ! -f "$extFile" ];then
|
||||
echo "php-$version 未安装${LIBNAME},请选择其它版本!"
|
||||
echo "php-$version 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
|
||||
$serverPath/php/init.d/php$version reload
|
||||
echo '==============================================='
|
||||
echo 'successful!'
|
||||
}
|
||||
|
||||
|
||||
if [ "$actionType" == 'install' ];then
|
||||
Install_lib
|
||||
elif [ "$actionType" == 'uninstall' ];then
|
||||
Uninstall_lib
|
||||
fi
|
||||
@@ -0,0 +1,77 @@
|
||||
#!/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")
|
||||
serverPath=$(dirname "$rootPath")
|
||||
sourcePath=${serverPath}/source
|
||||
sysName=`uname`
|
||||
install_tmp=${rootPath}/tmp/mw_install.pl
|
||||
|
||||
Install_php()
|
||||
{
|
||||
#------------------------ install start ------------------------------------#
|
||||
echo "安装php-5.5.38 ..." > $install_tmp
|
||||
mkdir -p $sourcePath/php
|
||||
mkdir -p $serverPath/php
|
||||
|
||||
if [ ! -f $sourcePath/php/php-5.5.38.tar.xz ];then
|
||||
wget -O $sourcePath/php/php-5.5.38.tar.xz https://museum.php.net/php5/php-5.5.38.tar.xz
|
||||
fi
|
||||
|
||||
if [ ! -d $sourcePath/php/php-5.5.38 ];then
|
||||
cd $sourcePath/php && tar -Jxf $sourcePath/php/php-5.5.38.tar.xz
|
||||
fi
|
||||
|
||||
OPTIONS=''
|
||||
if [ $sysName == 'Darwin' ]; then
|
||||
OPTIONS='--without-iconv'
|
||||
OPTIONS="${OPTIONS} --with-curl=${serverPath}/lib/curl"
|
||||
else
|
||||
OPTIONS="--with-iconv=${serverPath}/lib/libiconv"
|
||||
OPTIONS="${OPTIONS} --with-gd --enable-gd-native-ttf"
|
||||
OPTIONS="${OPTIONS} --with-curl"
|
||||
fi
|
||||
|
||||
|
||||
cd $sourcePath/php/php-5.5.38 && ./configure \
|
||||
--prefix=$serverPath/php/55 \
|
||||
--exec-prefix=$serverPath/php/55 \
|
||||
--with-config-file-path=$serverPath/php/55/etc \
|
||||
--with-zlib-dir=$serverPath/lib/zlib \
|
||||
--enable-mysqlnd \
|
||||
--enable-zip \
|
||||
--enable-simplexml \
|
||||
--enable-intl \
|
||||
--enable-mbstring \
|
||||
--enable-sockets \
|
||||
--enable-ftp \
|
||||
--enable-wddx \
|
||||
--enable-soap \
|
||||
--enable-posix \
|
||||
--enable-sysvmsg \
|
||||
--enable-sysvsem \
|
||||
--enable-sysvshm \
|
||||
$OPTIONS \
|
||||
--enable-fpm \
|
||||
&& make && make install && make clean
|
||||
|
||||
#------------------------ install end ------------------------------------#
|
||||
}
|
||||
|
||||
|
||||
Uninstall_php()
|
||||
{
|
||||
$serverPath/php/init.d/php55 stop
|
||||
rm -rf $serverPath/php/55
|
||||
echo "卸载php-5.5.38 ..." > $install_tmp
|
||||
}
|
||||
|
||||
action=${1}
|
||||
if [ "${1}" == 'install' ];then
|
||||
Install_php
|
||||
else
|
||||
Uninstall_php
|
||||
fi
|
||||
@@ -0,0 +1,85 @@
|
||||
#!/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=memcache
|
||||
LIBV=2.2.7
|
||||
sysName=`uname`
|
||||
actionType=$1
|
||||
version=$2
|
||||
extFile=$serverPath/php/${version}/lib/php/extensions/no-debug-non-zts-20121212/${LIBNAME}.so
|
||||
|
||||
Install_lib()
|
||||
{
|
||||
isInstall=`cat $serverPath/php/$version/etc/php.ini|grep "${LIBNAME}.so"`
|
||||
if [ "${isInstall}" != "" ];then
|
||||
echo "php$version 已安装${LIBNAME},请选择其它版本!"
|
||||
return
|
||||
fi
|
||||
|
||||
if [ ! -f "$extFile" ];then
|
||||
php_lib=$sourcePath/php_${version}_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 --enable-memcache --with-zlib-dir
|
||||
make && make install
|
||||
|
||||
cd $php_lib
|
||||
rm -rf ${LIBNAME}-*
|
||||
fi
|
||||
|
||||
if [ ! -f "$extFile" ];then
|
||||
echo "ERROR!"
|
||||
return
|
||||
fi
|
||||
echo "extension=${LIBNAME}.so" >> $serverPath/php/$version/etc/php.ini
|
||||
echo "extension=${LIBNAME}" >> $serverPath/php/$version/etc/php.ini
|
||||
|
||||
$serverPath/php/init.d/php$version reload
|
||||
echo '==========================================================='
|
||||
echo 'successful!'
|
||||
}
|
||||
|
||||
|
||||
Uninstall_lib()
|
||||
{
|
||||
if [ ! -f "$serverPath/php/$version/bin/php-config" ];then
|
||||
echo "php-$version 未安装,请选择其它版本!"
|
||||
return
|
||||
fi
|
||||
|
||||
if [ ! -f "$extFile" ];then
|
||||
echo "php-$version 未安装${LIBNAME},请选择其它版本!"
|
||||
echo "php-$version not install memcache, 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
|
||||
$serverPath/php/init.d/php$version reload
|
||||
echo '==============================================='
|
||||
echo 'successful!'
|
||||
}
|
||||
|
||||
|
||||
if [ "$actionType" == 'install' ];then
|
||||
Install_lib
|
||||
elif [ "$actionType" == 'uninstall' ];then
|
||||
Uninstall_lib
|
||||
fi
|
||||
@@ -0,0 +1,88 @@
|
||||
#!/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=memcached
|
||||
LIBV=2.2.0
|
||||
sysName=`uname`
|
||||
actionType=$1
|
||||
version=$2
|
||||
extFile=$serverPath/php/${version}/lib/php/extensions/no-debug-non-zts-20121212/${LIBNAME}.so
|
||||
|
||||
Install_lib()
|
||||
{
|
||||
isInstall=`cat $serverPath/php/$version/etc/php.ini|grep "${LIBNAME}.so"`
|
||||
if [ "${isInstall}" != "" ];then
|
||||
echo "php$version 已安装${LIBNAME},请选择其它版本!"
|
||||
return
|
||||
fi
|
||||
|
||||
|
||||
if [ ! -f "$extFile" ];then
|
||||
|
||||
php_lib=$sourcePath/php_${version}_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 \
|
||||
--enable-memcache --with-zlib-dir=$serverPath/lib/zlib \
|
||||
--with-libmemcached-dir=$serverPath/lib/libmemcached
|
||||
make && make install
|
||||
|
||||
cd $php_lib
|
||||
rm -rf ${LIBNAME}-*
|
||||
fi
|
||||
|
||||
if [ ! -f "$extFile" ];then
|
||||
echo "ERROR!"
|
||||
return
|
||||
fi
|
||||
echo "extension=${LIBNAME}.so" >> $serverPath/php/$version/etc/php.ini
|
||||
|
||||
$serverPath/php/init.d/php$version reload
|
||||
echo '==========================================================='
|
||||
echo 'successful!'
|
||||
}
|
||||
|
||||
|
||||
Uninstall_lib()
|
||||
{
|
||||
if [ ! -f "$serverPath/php/$version/bin/php-config" ];then
|
||||
echo "php-$version 未安装,请选择其它版本!"
|
||||
return
|
||||
fi
|
||||
|
||||
if [ ! -f "$extFile" ];then
|
||||
echo "php-$version 未安装${LIBNAME},请选择其它版本!"
|
||||
echo "php-$version 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
|
||||
$serverPath/php/init.d/php$version reload
|
||||
echo '==============================================='
|
||||
echo 'successful!'
|
||||
}
|
||||
|
||||
|
||||
if [ "$actionType" == 'install' ];then
|
||||
Install_lib
|
||||
elif [ "$actionType" == 'uninstall' ];then
|
||||
Uninstall_lib
|
||||
fi
|
||||
@@ -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=mongo
|
||||
LIBV=1.6.16
|
||||
sysName=`uname`
|
||||
actionType=$1
|
||||
version=$2
|
||||
extFile=$serverPath/php/${version}/lib/php/extensions/no-debug-non-zts-20121212/${LIBNAME}.so
|
||||
|
||||
Install_lib()
|
||||
{
|
||||
isInstall=`cat $serverPath/php/$version/etc/php.ini|grep "${LIBNAME}.so"`
|
||||
if [ "${isInstall}" != "" ];then
|
||||
echo "php$version 已安装${LIBNAME},请选择其它版本!"
|
||||
return
|
||||
fi
|
||||
|
||||
|
||||
if [ ! -f "$extFile" ];then
|
||||
|
||||
php_lib=$sourcePath/php_${version}_lib
|
||||
mkdir -p $php_lib
|
||||
|
||||
if [ ! -f $php_lib/${LIBNAME}-${LIBV}.tgz ];then
|
||||
wget -O $php_lib/${LIBNAME}-${LIBV}.tgz http://pecl.php.net/get/${LIBNAME}-${LIBV}.tgz
|
||||
fi
|
||||
|
||||
OPTIONS=''
|
||||
if [ $sysName == 'Darwin' ]; then
|
||||
OPTIONS="--with-openssl-dir=/usr/local/Cellar/openssl/1.0.2q"
|
||||
fi
|
||||
|
||||
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 $OPTIONS
|
||||
|
||||
make && make install
|
||||
|
||||
cd $php_lib
|
||||
rm -rf ${LIBNAME}-*
|
||||
fi
|
||||
|
||||
if [ ! -f "$extFile" ];then
|
||||
echo "ERROR!"
|
||||
return
|
||||
fi
|
||||
|
||||
echo "" >> $serverPath/php/$version/etc/php.ini
|
||||
echo "[${LIBNAME}]" >> $serverPath/php/$version/etc/php.ini
|
||||
echo "extension=${LIBNAME}.so" >> $serverPath/php/$version/etc/php.ini
|
||||
|
||||
$serverPath/php/init.d/php$version reload
|
||||
echo '==========================================================='
|
||||
echo 'successful!'
|
||||
}
|
||||
|
||||
|
||||
Uninstall_lib()
|
||||
{
|
||||
if [ ! -f "$serverPath/php/$version/bin/php-config" ];then
|
||||
echo "php$version 未安装,请选择其它版本!"
|
||||
return
|
||||
fi
|
||||
|
||||
if [ ! -f "$extFile" ];then
|
||||
echo "php$version 未安装${LIBNAME},请选择其它版本!"
|
||||
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
|
||||
$serverPath/php/init.d/php$version reload
|
||||
echo '==============================================='
|
||||
echo 'successful!'
|
||||
}
|
||||
|
||||
|
||||
if [ "$actionType" == 'install' ];then
|
||||
Install_lib
|
||||
elif [ "$actionType" == 'uninstall' ];then
|
||||
Uninstall_lib
|
||||
fi
|
||||
@@ -0,0 +1,89 @@
|
||||
#!/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=mongodb
|
||||
LIBV=1.5.3
|
||||
sysName=`uname`
|
||||
actionType=$1
|
||||
version=$2
|
||||
extFile=$serverPath/php/${version}/lib/php/extensions/no-debug-non-zts-20121212/${LIBNAME}.so
|
||||
|
||||
Install_lib()
|
||||
{
|
||||
isInstall=`cat $serverPath/php/$version/etc/php.ini|grep "${LIBNAME}.so"`
|
||||
if [ "${isInstall}" != "" ];then
|
||||
echo "php$version 已安装${LIBNAME},请选择其它版本!"
|
||||
return
|
||||
fi
|
||||
|
||||
|
||||
if [ ! -f "$extFile" ];then
|
||||
|
||||
php_lib=$sourcePath/php_${version}_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
|
||||
|
||||
cd $php_lib
|
||||
rm -rf ${LIBNAME}-*
|
||||
fi
|
||||
|
||||
if [ ! -f "$extFile" ];then
|
||||
echo "ERROR!"
|
||||
return
|
||||
fi
|
||||
|
||||
echo "" >> $serverPath/php/$version/etc/php.ini
|
||||
echo "[${LIBNAME}]" >> $serverPath/php/$version/etc/php.ini
|
||||
echo "extension=${LIBNAME}.so" >> $serverPath/php/$version/etc/php.ini
|
||||
|
||||
$serverPath/php/init.d/php$version reload
|
||||
echo '==========================================================='
|
||||
echo 'successful!'
|
||||
}
|
||||
|
||||
|
||||
Uninstall_lib()
|
||||
{
|
||||
if [ ! -f "$serverPath/php/$version/bin/php-config" ];then
|
||||
echo "php$version 未安装,请选择其它版本!"
|
||||
return
|
||||
fi
|
||||
|
||||
if [ ! -f "$extFile" ];then
|
||||
echo "php$version 未安装${LIBNAME},请选择其它版本!"
|
||||
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
|
||||
$serverPath/php/init.d/php$version reload
|
||||
echo '==============================================='
|
||||
echo 'successful!'
|
||||
}
|
||||
|
||||
|
||||
if [ "$actionType" == 'install' ];then
|
||||
Install_lib
|
||||
elif [ "$actionType" == 'uninstall' ];then
|
||||
Uninstall_lib
|
||||
fi
|
||||
@@ -0,0 +1,55 @@
|
||||
#!/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=opcache
|
||||
LIBV=7.0.5
|
||||
sysName=`uname`
|
||||
actionType=$1
|
||||
version=$2
|
||||
extFile=$serverPath/php/${version}/lib/php/extensions/no-debug-non-zts-20121212/${LIBNAME}.so
|
||||
|
||||
Install_lib()
|
||||
{
|
||||
echo "" >> $serverPath/php/$version/etc/php.ini
|
||||
echo "[opcache]" >> $serverPath/php/$version/etc/php.ini
|
||||
echo "zend_extension=${LIBNAME}.so" >> $serverPath/php/$version/etc/php.ini
|
||||
echo "opcache.enable=1" >> $serverPath/php/$version/etc/php.ini
|
||||
echo "opcache.memory_consumption=128" >> $serverPath/php/$version/etc/php.ini
|
||||
echo "opcache.interned_strings_buffer=8" >> $serverPath/php/$version/etc/php.ini
|
||||
echo "opcache.max_accelerated_files=4000" >> $serverPath/php/$version/etc/php.ini
|
||||
echo "opcache.revalidate_freq=60" >> $serverPath/php/$version/etc/php.ini
|
||||
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
|
||||
echo '==========================================================='
|
||||
echo 'successful!'
|
||||
}
|
||||
|
||||
|
||||
Uninstall_lib()
|
||||
{
|
||||
sed -i '_bak' "/${LIBNAME}.so/d" $serverPath/php/$version/etc/php.ini
|
||||
sed -i '_bak' "/${LIBNAME}/d" $serverPath/php/$version/etc/php.ini
|
||||
|
||||
$serverPath/php/init.d/php$version reload
|
||||
echo '==============================================='
|
||||
echo 'successful!'
|
||||
}
|
||||
|
||||
|
||||
if [ "$actionType" == 'install' ];then
|
||||
Install_lib
|
||||
elif [ "$actionType" == 'uninstall' ];then
|
||||
Uninstall_lib
|
||||
fi
|
||||
@@ -0,0 +1,93 @@
|
||||
#!/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=redis
|
||||
LIBV=4.2.0
|
||||
sysName=`uname`
|
||||
actionType=$1
|
||||
version=$2
|
||||
|
||||
extDir=$serverPath/php/${version}/lib/php/extensions/no-debug-non-zts-20121212/
|
||||
|
||||
Install_lib()
|
||||
{
|
||||
isInstall=`cat $serverPath/php/$version/etc/php.ini|grep "${LIBNAME}.so"`
|
||||
if [ "${isInstall}" != "" ];then
|
||||
echo "php$version 已安装${LIBNAME},请选择其它版本!"
|
||||
return
|
||||
fi
|
||||
|
||||
extFile=$extDir${LIBNAME}.so
|
||||
if [ ! -f "$extFile" ];then
|
||||
|
||||
php_lib=$sourcePath/php_${version}_lib
|
||||
mkdir -p $php_lib
|
||||
|
||||
if [ ! -f $php_lib/${LIBNAME}-${LIBV}.tgz ];then
|
||||
wget -O $php_lib/${LIBNAME}-${LIBV}.tgz http://pecl.php.net/get/${LIBNAME}-${LIBV}.tgz
|
||||
fi
|
||||
|
||||
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
|
||||
|
||||
cd $php_lib
|
||||
rm -rf ${LIBNAME}-*
|
||||
fi
|
||||
sleep 1
|
||||
if [ ! -f "$extFile" ];then
|
||||
echo "ERROR!"
|
||||
return
|
||||
fi
|
||||
|
||||
echo "[${LIBNAME}]" >> $serverPath/php/$version/etc/php.ini
|
||||
echo "extension=${LIBNAME}.so" >> $serverPath/php/$version/etc/php.ini
|
||||
|
||||
$serverPath/php/init.d/php$version reload
|
||||
echo '==========================================================='
|
||||
echo 'successful!'
|
||||
}
|
||||
|
||||
|
||||
Uninstall_lib()
|
||||
{
|
||||
if [ ! -f "$serverPath/php/$version/bin/php-config" ];then
|
||||
echo "php$version 未安装,请选择其它版本!"
|
||||
return
|
||||
fi
|
||||
|
||||
extFile=$extDir${LIBNAME}.so
|
||||
if [ ! -f "$extFile" ];then
|
||||
echo "php$version 未安装${LIBNAME},请选择其它版本!"
|
||||
echo "php-$vphp not install memcache, 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
|
||||
$serverPath/php/init.d/php$version reload
|
||||
echo '==============================================='
|
||||
echo 'successful!'
|
||||
}
|
||||
|
||||
|
||||
|
||||
if [ "$actionType" == 'install' ];then
|
||||
Install_lib
|
||||
elif [ "$actionType" == 'uninstall' ];then
|
||||
Uninstall_lib
|
||||
fi
|
||||