1--TEST--
2FPM: UNIX socket owner and group settings can be numeric
3--SKIPIF--
4<?php
5include "skipif.inc";
6FPM\Tester::skipIfRoot();
7FPM\Tester::skipIfPosixNotLoaded();
8?>
9--FILE--
10<?php
11
12require_once "tester.inc";
13
14$cfg = <<<EOT
15[global]
16error_log = {{FILE:LOG}}
17[unconfined]
18listen = {{ADDR:UDS}}
19listen.owner = {{UID}}
20listen.group = {{GID}}
21user = {{USER}}
22ping.path = /ping
23ping.response = pong
24pm = dynamic
25pm.max_children = 5
26pm.start_servers = 2
27pm.min_spare_servers = 1
28pm.max_spare_servers = 3
29EOT;
30
31$tester = new FPM\Tester($cfg);
32$tester->testConfig();
33$tester->start();
34$tester->expectLogNotice(
35    "'user' directive is ignored when FPM is not running as root",
36    'unconfined'
37);
38$tester->expectLogStartNotices();
39$tester->ping('{{ADDR:UDS}}');
40$st = stat($tester->getListen('{{ADDR:UDS}}'));
41if ($st) {
42  $pw = posix_getpwuid($st['uid']);
43  $gr = posix_getgrgid($st['gid']);
44  $user  = $pw ? $pw['name'] : 'UNKNOWN';
45  $group = $gr ? $gr['name'] : 'UNKNOWN';
46  echo "{$st['uid']}/{$user},{$st['gid']}/{$group}\n";
47} else {
48  echo "stat failed for " . $tester->getListen('{{ADDR:UDS}}');
49}
50$tester->terminate();
51$tester->expectLogTerminatingNotices();
52$tester->close();
53
54?>
55Done
56--EXPECTF--
57%d/%s,%d/%s
58Done
59--CLEAN--
60<?php
61require_once "tester.inc";
62FPM\Tester::clean();
63?>
64