xref: /PHP-5.6/sapi/fpm/tests/011.phpt (revision ec26d7a8)
1--TEST--
2FPM: Test IPv4 all addresses (bug #68420)
3--SKIPIF--
4<?php include "skipif.inc"; ?>
5--FILE--
6<?php
7
8include "include.inc";
9
10$logfile = dirname(__FILE__).'/php-fpm.log.tmp';
11$port = 9000+PHP_INT_SIZE;
12
13$cfg = <<<EOT
14[global]
15error_log = $logfile
16[unconfined]
17listen = $port
18ping.path = /ping
19ping.response = pong
20pm = dynamic
21pm.max_children = 5
22pm.start_servers = 2
23pm.min_spare_servers = 1
24pm.max_spare_servers = 3
25EOT;
26
27$fpm = run_fpm($cfg, $tail);
28if (is_resource($fpm)) {
29    fpm_display_log($tail, 2);
30    try {
31		var_dump(strpos(run_request('127.0.0.1', $port), 'pong'));
32		echo "IPv4 ok\n";
33	} catch (Exception $e) {
34		echo "IPv4 error\n";
35	}
36
37	proc_terminate($fpm);
38    stream_get_contents($tail);
39    fclose($tail);
40    proc_close($fpm);
41}
42
43?>
44--EXPECTF--
45[%d-%s-%d %d:%d:%d] NOTICE: fpm is running, pid %d
46[%d-%s-%d %d:%d:%d] NOTICE: ready to handle connections
47int(%d)
48IPv4 ok
49--CLEAN--
50<?php
51    $logfile = dirname(__FILE__).'/php-fpm.log.tmp';
52    @unlink($logfile);
53?>
54