瀏覽代碼

Fix unix domain socket file permission

Socket file permission is not same with forked worker.Fix it.
Ares 8 年之前
父節點
當前提交
ef42b9f730
共有 1 個文件被更改,包括 8 次插入0 次删除
  1. 8 0
      Worker.php

+ 8 - 0
Worker.php

@@ -1654,6 +1654,14 @@ class Worker
 
         if ($this->transport === 'ssl') {
             stream_socket_enable_crypto($this->_mainSocket, false);
+        } elseif ($this->transport === 'unix') {
+            $socketFile = substr($address, 2);
+            if ($this->user) {
+                chown($socketFile, $this->user);
+            }
+            if ($this->group) {
+                chgrp($socketFile, $this->group);
+            }
         }
 
         // Try to open keepalive for tcp and disable Nagle algorithm.