1--TEST-- 2FPM: Test splited configuration and load order #68391 3--SKIPIF-- 4<?php 5include "skipif.inc"; 6 7$cfg = <<<EOT 8[global] 9error_log = /dev/null 10[poold_ondemand] 11listen=127.0.0.1:9000 12pm = ondemand 13pm.max_children = 2 14pm.process_idle_timeout = 10 15EOT; 16 17if (test_fpm_conf($cfg, $msg) == false) { 18 die("skip " . $msg); 19} 20?> 21--FILE-- 22<?php 23 24include "include.inc"; 25 26$logfile = __DIR__.'/php-fpm.log.tmp'; 27$logdir = __DIR__.'/conf.d'; 28$port = 9000+PHP_INT_SIZE; 29 30// Main configuration 31$cfg = <<<EOT 32[global] 33error_log = $logfile 34log_level = notice 35include = $logdir/*.conf 36EOT; 37 38// Splited configuration 39@mkdir($logdir); 40$i=$port; 41$names = ['cccc', 'aaaa', 'eeee', 'dddd', 'bbbb']; 42foreach($names as $name) { 43 $poolcfg = <<<EOT 44[$name] 45listen = 127.0.0.1:$i 46listen.allowed_clients=127.0.0.1 47user = foo 48pm = ondemand 49pm.max_children = 5 50EOT; 51 file_put_contents("$logdir/$name.conf", $poolcfg); 52 $i++; 53} 54 55// Test 56$fpm = run_fpm($cfg, $tail); 57if (is_resource($fpm)) { 58 fpm_display_log($tail, count($names)+2); 59 $i=$port; 60 foreach($names as $name) { 61 try { 62 run_request('127.0.0.1', $i++); 63 echo "OK $name\n"; 64 } catch (Exception $e) { 65 echo "Error 1\n"; 66 } 67 } 68 proc_terminate($fpm); 69 fpm_display_log($tail, -1); 70 fclose($tail); 71 proc_close($fpm); 72} 73 74?> 75Done 76--EXPECTF-- 77[%s] NOTICE: [pool aaaa] 'user' directive is ignored when FPM is not running as root 78[%s] NOTICE: [pool bbbb] 'user' directive is ignored when FPM is not running as root 79[%s] NOTICE: [pool cccc] 'user' directive is ignored when FPM is not running as root 80[%s] NOTICE: [pool dddd] 'user' directive is ignored when FPM is not running as root 81[%s] NOTICE: [pool eeee] 'user' directive is ignored when FPM is not running as root 82[%s] NOTICE: fpm is running, pid %d 83[%s] NOTICE: ready to handle connections 84OK cccc 85OK aaaa 86OK eeee 87OK dddd 88OK bbbb 89[%s] NOTICE: Terminating ... 90[%s] NOTICE: exiting, bye-bye! 91Done 92--CLEAN-- 93<?php 94 $logfile = __DIR__.'/php-fpm.log.tmp'; 95 $logdir = __DIR__.'/conf.d'; 96 @unlink($logfile); 97 foreach(glob("$logdir/*.conf") as $name) { 98 unlink($name); 99 } 100 @rmdir($logdir); 101?> 102