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