registerDefinition('ThriftTest', __DIR__ . '/gen-php-classmap'); $loader->register(); require_once __DIR__ . '/Handler.php'; $protocolFactory = thrift_test_protocol_factory(getenv('THRIFT_TEST_PROTOCOL') ?: 'binary'); $processor = new ThriftTest\ThriftTestProcessor(new Handler()); (new HttpServer($processor, $protocolFactory))->serve(); return; } // CLI launcher: sourced from TestServer.php; $port and $protocol are in scope. if (!function_exists('pcntl_exec')) { fwrite(STDERR, "PHP HTTP cross-test requires ext-pcntl.\n"); exit(1); } $env = getenv(); $env['THRIFT_TEST_PROTOCOL'] = $protocol; echo "Starting the Test server (HTTP via php -S)...\n"; // -d flags mirror the launcher invocation in test/tests.json — keep in sync. pcntl_exec(PHP_BINARY, [ '-dextension_dir=php_ext_dir', '-dextension=thrift_protocol.so', '-ddisplay_errors=stderr', '-dlog_errors=0', '-derror_reporting=E_ALL', '-S', '127.0.0.1:' . $port, __FILE__, ], $env); fwrite(STDERR, "pcntl_exec failed\n"); exit(1);