diff --git a/plugins/php/conf/phpinfo.conf b/plugins/php/conf/phpinfo.conf index 223441d3f..577a70ec0 100644 --- a/plugins/php/conf/phpinfo.conf +++ b/plugins/php/conf/phpinfo.conf @@ -1,4 +1,4 @@ location /{$PHP_VERSION} { root {$ROOT_PATH}/phpinfo; - include enable-php-{$PHP_VERSION}.conf; + include {$SERVER_PATH}/web_conf/php/conf/enable-php-{$PHP_VERSION}.conf; } \ No newline at end of file diff --git a/plugins/php/index.py b/plugins/php/index.py index bd556eaee..0d73308d5 100755 --- a/plugins/php/index.py +++ b/plugins/php/index.py @@ -605,30 +605,34 @@ def setDisableFunc(version): def checkPhpinfoFile(v): - if mw.isInstalledWeb(): - sdir = mw.getServerDir() - dfile = sdir + '/openresty/nginx/conf/php_status/phpinfo_' + v + '.conf' - if not os.path.exists(dfile): - tpl = getPluginDir() + '/conf/phpinfo.conf' - content = mw.readFile(tpl) - content = contentReplace(content, v) - mw.writeFile(dfile, content) - mw.restartWeb() + sdir = mw.getServerDir() + dfile = sdir + '/web_conf/php/status/phpinfo_' + v + '.conf' + if not os.path.exists(dfile): + tpl = getPluginDir() + '/conf/phpinfo.conf' + content = mw.readFile(tpl) + content = contentReplace(content, v) + mw.writeFile(dfile, content) + mw.restartWeb() def getPhpinfo(v): checkPhpinfoFile(v) sPath = mw.getRootDir() + '/phpinfo/' + v - mw.execShell("rm -rf " + mw.getRootDir() + '/phpinfo') + + # mw.execShell("rm -rf " + mw.getRootDir() + '/phpinfo') mw.execShell("mkdir -p " + sPath) mw.writeFile(sPath + '/phpinfo.php', '') url = 'http://127.0.0.1/' + v + '/phpinfo.php' phpinfo = mw.httpGet(url) - os.system("rm -rf " + mw.getRootDir() + '/phpinfo') + # os.system("rm -rf " + mw.getRootDir() + '/phpinfo') + + print(mw.getRootDir() + '/phpinfo', sPath, url) return phpinfo def get_php_info(args): + if not mw.isInstalledWeb(): + return "openresty is not running!!!" return getPhpinfo(args['version'])