1--TEST-- 2FPM: UNIX socket filename is too for start 3--SKIPIF-- 4<?php 5include "skipif.inc"; ?> 6--FILE-- 7<?php 8 9require_once "tester.inc"; 10$socketFilePrefix = __DIR__ . '/socket-file'; 11$socketFile = sprintf( 12 "%s-fpm-unix-socket-too-long-filename-but-starts-anyway%s.sock", 13 $socketFilePrefix, 14 str_repeat('-0000', 11) 15); 16 17$cfg = <<<EOT 18[global] 19error_log = {{FILE:LOG}} 20 21[fpm_pool] 22listen = $socketFile 23pm = static 24pm.max_children = 1 25catch_workers_output = yes 26EOT; 27 28$tester = new FPM\Tester($cfg); 29$tester->start(); 30$tester->expectLogStartNotices(); 31$tester->expectLogPattern( 32 sprintf( 33 '/\[pool fpm_pool\] cannot bind to UNIX socket \'%s\' as path is too long ' 34 . '\(found length: %d, maximal length: \d+\), trying cut socket path instead \'.+\'/', 35 preg_quote($socketFile, '/'), 36 strlen($socketFile) 37 ), 38 true 39); 40 41$files = glob($socketFilePrefix . '*'); 42 43if ($files === []) { 44 echo 'Socket files were not found.' . PHP_EOL; 45} 46 47if ($socketFile === $files[0]) { 48 // this means the socket file path length is not an issue (anymore). Might be not long enough 49 echo 'Socket file is the same as configured.' . PHP_EOL; 50} 51 52$tester->terminate(); 53$tester->expectLogTerminatingNotices(); 54$tester->close(); 55?> 56Done 57--EXPECT-- 58Done 59--CLEAN-- 60<?php 61require_once "tester.inc"; 62FPM\Tester::clean(); 63 64// cleanup socket file if php-fpm was not killed 65$socketFile = sprintf( 66 "/socket-file-fpm-unix-socket-too-long-filename-but-starts-anyway%s.sock", 67 __DIR__, 68 str_repeat('-0000', 11) 69); 70 71if (is_file($socketFile)) { 72 unlink($socketFile); 73} 74?> 75