diff --git a/class/core/plugins_api.py b/class/core/plugins_api.py
index ea75cda5a..098027f5f 100755
--- a/class/core/plugins_api.py
+++ b/class/core/plugins_api.py
@@ -251,6 +251,12 @@ class plugins_api:
return public.returnJson(True, '安装成功!')
public.execShell("rm -rf " + plugin_path)
return public.returnJson(False, '安装失败!')
+
+ def phpinfoApi(self):
+ version = request.form.get('version', '')
+ phpinfo = public.httpGet(
+ 'http://127.0.0.1/' + version + '/phpinfo.php')
+ return phpinfo
##### ----- end ----- ###
# 进程是否存在
diff --git a/class/core/public.py b/class/core/public.py
index 582218c46..691499e08 100755
--- a/class/core/public.py
+++ b/class/core/public.py
@@ -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):
diff --git a/class/core/site_api.py b/class/core/site_api.py
index 32b4fd6f0..74d0ac347 100755
--- a/class/core/site_api.py
+++ b/class/core/site_api.py
@@ -611,7 +611,7 @@ class site_api:
# print home_cert
cmd = 'export ACCOUNT_EMAIL=' + email + ' && ' + execStr
- print cmd
+ # print cmd
result = public.execShell(cmd)
if not os.path.exists(home_cert.replace("\*", "*")):
diff --git a/plugins/php/index.py b/plugins/php/index.py
index 32f960448..efeb31310 100755
--- a/plugins/php/index.py
+++ b/plugins/php/index.py
@@ -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
@@ -480,28 +482,29 @@ def setDisableFunc(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'
+ desc_file = public.getServerDir() + '/openresty/nginx/conf/php_status/phpinfo_' + \
+ str(v) + '.conf'
if not os.path.exists(desc_file):
tpl = getPluginDir() + '/conf/phpinfo.conf'
content = public.readFile(tpl)
- content = contentReplace(content, version)
+ content = contentReplace(content, v)
public.writeFile(desc_file, content)
public.restartWeb()
-def getPhpinfo(version):
- checkPhpinfoFile(version)
- sPath = public.getRootDir() + '/phpinfo/' + version
+def getPhpinfo(v):
+ checkPhpinfoFile(v)
+ sPath = public.getRootDir() + '/phpinfo/' + str(v)
# public.execShell("rm -rf " + public.getRootDir() + '/phpinfo')
public.execShell("mkdir -p " + sPath)
public.writeFile(sPath + '/phpinfo.php', '')
- # print 'http://127.0.0.1/' + version + '/phpinfo.php'
- phpinfo = public.httpGet('http://127.0.0.1/' + version + '/phpinfo.php', 3)
+ # print 'http://127.0.0.1/' + str(v) + '/phpinfo.php'
+ phpinfo = public.httpGet('http://127.0.0.1/' + str(v) + '/phpinfo.php')
+ public.writeFile('/tmp/phpinfo.txt', phpinfo)
# os.system("rm -rf " + public.getRootDir() + '/phpinfo')
- return phpinfo
+ return ''
def getLibConf(version):
diff --git a/plugins/php/js/php.js b/plugins/php/js/php.js
index 784349ab9..33d38a4da 100755
--- a/plugins/php/js/php.js
+++ b/plugins/php/js/php.js
@@ -373,7 +373,7 @@ function setDisableFunc(version, act, fs) {
//phpinfo
function getPhpinfo(version) {
- var con = '';
+ var con = '';
$(".soft-man-con").html(con);
}
@@ -392,6 +392,20 @@ function getPHPInfo(version) {
});
}
+//获取PHPInfo
+function getPHPInfo_new(version) {
+ $.post('/plugins/phpinfo', {v:version}, function(data) {
+ layer.open({
+ type: 1,
+ title: "PHP-" + version + "-PHPINFO",
+ area: ['90%', '90%'],
+ closeBtn: 2,
+ shadeClose: true,
+ content: data
+ });
+ });
+}
+
function phpLibConfig(version){
phpPost('get_lib_conf', version, '', function(data){
diff --git a/setting.py b/setting.py
index d24166cfe..ebf6190bd 100755
--- a/setting.py
+++ b/setting.py
@@ -6,10 +6,9 @@ import sys
import os
chdir = os.getcwd()
sys.path.append(chdir + '/class/core')
-sys.path.append("/usr/local/lib/python2.7/site-packages")
+# sys.path.append("/usr/local/lib/python2.7/site-packages")
import public
import system_api
-
# cpu_info = system_api.system_api().getCpuInfo()
# workers = cpu_info[1] + 1