diff --git a/plugins/php/conf/www.conf b/plugins/php/conf/www.conf index 52922a67f..df5c911de 100644 --- a/plugins/php/conf/www.conf +++ b/plugins/php/conf/www.conf @@ -1,6 +1,6 @@ [www] -user = www -group = www +user = {$PHP_USER} +group = {$PHP_GROUP} listen = /tmp/php-cgi-{$PHP_VERSION}.sock pm = dynamic pm.max_children = 5 diff --git a/plugins/php/index.py b/plugins/php/index.py index 92b2c7ab1..a1004e698 100755 --- a/plugins/php/index.py +++ b/plugins/php/index.py @@ -15,7 +15,7 @@ sys.path.append(os.getcwd() + "/class/core") import public app_debug = False -if public.getOs() == 'darwin': +if public.isAppleSystem(): app_debug = True @@ -72,6 +72,15 @@ def contentReplace(content, version): service_path = public.getServerDir() content = content.replace('{$SERVER_PATH}', service_path) content = content.replace('{$PHP_VERSION}', version) + + if public.isAppleSystem(): + user = public.execShell( + "who | sed -n '2, 1p' |awk '{print $1}'")[0].strip() + content = content.replace('{$PHP_USER}', user) + content = content.replace('{$PHP_GROUP}', 'staff') + else: + content = content.replace('{$PHP_USER}', 'www') + content = content.replace('{$PHP_GROUP}', 'www') return content @@ -89,7 +98,7 @@ def makeOpenrestyConf(): tpl = getPluginDir() + '/conf/enable-php.conf' tpl_content = public.readFile(tpl) for x in range(len(versions)): - w_content = tpl_content.replace('{$PHP_VERSION}', versions[x]) + w_content = contentReplace(tpl_content, versions[x]) desc_file = public.getServerDir() + '/openresty/nginx/conf/enable-php-' + \ versions[x] + '.conf' if not os.path.exists(desc_file):