File: 008.phpt

package info (click to toggle)
php5 5.6.7%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie-kfreebsd
  • size: 150,376 kB
  • sloc: ansic: 727,510; php: 21,966; sh: 12,356; cpp: 8,763; xml: 6,105; yacc: 1,551; exp: 1,514; makefile: 1,461; pascal: 1,048; awk: 538; perl: 315; sql: 22
file content (84 lines) | stat: -rw-r--r-- 1,738 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
--TEST--
FPM: Test multi pool (dynamic + ondemand + static) (bug #68423)
--SKIPIF--
<?php include "skipif.inc"; ?>
--FILE--
<?php

include "include.inc";

$logfile = dirname(__FILE__).'/php-fpm.log.tmp';
$port1 = 9000+PHP_INT_SIZE;
$port2 = 9001+PHP_INT_SIZE;
$port3 = 9002+PHP_INT_SIZE;

$cfg = <<<EOT
[global]
error_log = $logfile
[pool_dynamic]
listen = 127.0.0.1:$port1
ping.path = /ping
ping.response = pong-dynamic
pm = dynamic
pm.max_children = 5
pm.start_servers = 2
pm.min_spare_servers = 1
pm.max_spare_servers = 3
[poold_ondemand]
listen = 127.0.0.1:$port2
ping.path = /ping
ping.response = pong-on-demand
pm = ondemand
pm.max_children = 2
pm.process_idle_timeout = 10
[pool_static]
listen = 127.0.0.1:$port3
ping.path = /ping
ping.response = pong-static
pm = static
pm.max_children = 2
EOT;

$fpm = run_fpm($cfg, $tail);
if (is_resource($fpm)) {
    fpm_display_log($tail, 2);
    try {
		var_dump(strpos(run_request('127.0.0.1', $port1), 'pong-dynamic'));
		echo "Dynamic ok\n";
	} catch (Exception $e) {
		echo "Dynamic error\n";
	}
    try {
		var_dump(strpos(run_request('127.0.0.1', $port2), 'pong-on-demand'));
		echo "OnDemand ok\n";
	} catch (Exception $e) {
		echo "OnDemand error\n";
	}
    try {
		var_dump(strpos(run_request('127.0.0.1', $port3), 'pong-static'));
		echo "Static ok\n";
	} catch (Exception $e) {
		echo "Static error\n";
	}

	proc_terminate($fpm);
    stream_get_contents($tail);
    fclose($tail);
    proc_close($fpm);
}

?>
--EXPECTF--
[%d-%s-%d %d:%d:%d] NOTICE: fpm is running, pid %d
[%d-%s-%d %d:%d:%d] NOTICE: ready to handle connections
int(%d)
Dynamic ok
int(%d)
OnDemand ok
int(%d)
Static ok
--CLEAN--
<?php
    $logfile = dirname(__FILE__).'/php-fpm.log.tmp';
    @unlink($logfile);
?>