xref: /PHP-5.6/sapi/fpm/tests/010.phpt (revision 3a16f511)
1--TEST--
2FPM: Test status page
3--SKIPIF--
4<?php include "skipif.inc"; ?>
5--XFAIL--
6randomly intermittently failing all the time in CI, with diff:
7017+ active processes:     0
8018+ total processes:      1
9017- active processes:     1
10018- total processes:      2
11--FILE--
12<?php
13
14include "include.inc";
15
16$logfile = dirname(__FILE__).'/php-fpm.log.tmp';
17$port = 9000+PHP_INT_SIZE;
18
19$cfg = <<<EOT
20[global]
21error_log = $logfile
22[unconfined]
23listen = 127.0.0.1:$port
24pm.status_path = /status
25pm = dynamic
26pm.max_children = 5
27pm.start_servers = 2
28pm.min_spare_servers = 1
29pm.max_spare_servers = 3
30EOT;
31
32$fpm = run_fpm($cfg, $tail);
33if (is_resource($fpm)) {
34    fpm_display_log($tail, 2);
35    try {
36		echo run_request('127.0.0.1', $port, '/status');
37
38		$html = run_request('127.0.0.1', $port, '/status', 'html');
39		var_dump(strpos($html, 'text/html') && strpos($html, 'DOCTYPE') && strpos($html, 'PHP-FPM Status Page'));
40
41		$json = run_request('127.0.0.1', $port, '/status', 'json');
42		var_dump(strpos($json, 'application/json') && strpos($json, '"pool":"unconfined"'));
43
44		$xml = run_request('127.0.0.1', $port, '/status', 'xml');
45		var_dump(strpos($xml, 'text/xml') && strpos($xml, '<?xml'));
46
47		echo "IPv4 ok\n";
48	} catch (Exception $e) {
49		echo "IPv4 error\n";
50	}
51
52	proc_terminate($fpm);
53    stream_get_contents($tail);
54    fclose($tail);
55    proc_close($fpm);
56}
57
58?>
59--EXPECTF--
60[%d-%s-%d %d:%d:%d] NOTICE: fpm is running, pid %d
61[%d-%s-%d %d:%d:%d] NOTICE: ready to handle connections
62X-Powered-By: PHP/%s
63Expires: %s
64Cache-Control: %s
65Content-type: text/plain%s
66
67pool:                 unconfined
68process manager:      dynamic
69start time:           %s
70start since:          %d
71accepted conn:        1
72listen queue:         0
73max listen queue:     0
74listen queue len:     %d
75idle processes:       1
76active processes:     1
77total processes:      2
78max active processes: 1
79max children reached: 0
80slow requests:        0
81
82bool(true)
83bool(true)
84bool(true)
85IPv4 ok
86--CLEAN--
87<?php
88    $logfile = dirname(__FILE__).'/php-fpm.log.tmp';
89    @unlink($logfile);
90?>
91