1--TEST-- 2FPM: Test reload configuration (bug #68442) 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$pidfile = dirname(__FILE__).'/php-fpm.pid'; 12$port = 9000+PHP_INT_SIZE; 13 14$cfg = <<<EOT 15[global] 16error_log = $logfile 17pid = $pidfile 18[unconfined] 19listen = 127.0.0.1:$port 20ping.path = /ping 21ping.response = pong 22pm = dynamic 23pm.max_children = 5 24pm.start_servers = 2 25pm.min_spare_servers = 1 26pm.max_spare_servers = 3 27EOT; 28 29$fpm = run_fpm($cfg, $tail); 30if (is_resource($fpm)) { 31 fpm_display_log($tail, 2); 32 try { 33 var_dump(strpos(run_request('127.0.0.1', $port), 'pong')); 34 echo "IPv4 ok\n"; 35 } catch (Exception $e) { 36 echo "IPv4 error\n"; 37 } 38 39 $pid=file_get_contents($pidfile); 40 if ($pid) { 41 exec("kill -USR2 $pid"); 42 } else { 43 die("PID not found\n"); 44 } 45 fpm_display_log($tail, 5); 46 47 try { 48 var_dump(strpos(run_request('127.0.0.1', $port), 'pong')); 49 echo "IPv4 ok\n"; 50 } catch (Exception $e) { 51 echo "IPv4 error\n"; 52 } 53 54 proc_terminate($fpm); 55 stream_get_contents($tail); 56 fclose($tail); 57 proc_close($fpm); 58} 59 60?> 61--EXPECTF-- 62[%d-%s-%d %d:%d:%d] NOTICE: fpm is running, pid %d 63[%d-%s-%d %d:%d:%d] NOTICE: ready to handle connections 64int(%d) 65IPv4 ok 66[%d-%s-%d %d:%d:%d] NOTICE: Reloading in progress ... 67[%d-%s-%d %d:%d:%d] NOTICE: reloading: %s 68[%d-%s-%d %d:%d:%d] NOTICE: using inherited socket fd=%d, "127.0.0.1:%d" 69[%d-%s-%d %d:%d:%d] NOTICE: fpm is running, pid %d 70[%d-%s-%d %d:%d:%d] NOTICE: ready to handle connections 71int(%d) 72IPv4 ok 73--CLEAN-- 74<?php 75 $logfile = dirname(__FILE__).'/php-fpm.log.tmp'; 76 @unlink($logfile); 77 $pidfile = dirname(__FILE__).'/php-fpm.pid'; 78 @unlink($pidfile); 79?> 80