xref: /PHP-5.6/sapi/fpm/tests/003.phpt (revision ad7ed6fe)
1--TEST--
2FPM: Test IPv6 support
3--SKIPIF--
4<?php include "skipif.inc";
5      @stream_socket_client('tcp://[::1]:0', $errno);
6      if ($errno != 111) die('skip IPv6 not supported.');
7?>
8--FILE--
9<?php
10
11include "include.inc";
12
13$logfile = dirname(__FILE__).'/php-fpm.log.tmp';
14$port = 9000+PHP_INT_SIZE;
15
16$cfg = <<<EOT
17[global]
18error_log = $logfile
19[unconfined]
20listen = [::1]:$port
21pm = dynamic
22pm.max_children = 5
23pm.start_servers = 2
24pm.min_spare_servers = 1
25pm.max_spare_servers = 3
26EOT;
27
28$fpm = run_fpm($cfg, $tail);
29if (is_resource($fpm)) {
30    fpm_display_log($tail, 2);
31    $i = 0;
32    while (($i++ < 30) && !($fp = fsockopen('[::1]', $port))) {
33        usleep(10000);
34    }
35    if ($fp) {
36        echo "Done\n";
37        fclose($fp);
38    }
39    proc_terminate($fpm);
40    stream_get_contents($tail);
41    fclose($tail);
42    proc_close($fpm);
43}
44
45?>
46--EXPECTF--
47[%d-%s-%d %d:%d:%d] NOTICE: fpm is running, pid %d
48[%d-%s-%d %d:%d:%d] NOTICE: ready to handle connections
49Done
50--CLEAN--
51<?php
52    $logfile = dirname(__FILE__).'/php-fpm.log.tmp';
53    @unlink($logfile);
54?>
55