. */ declare(strict_types=1); namespace Fisharebest\Webtrees\Http\RequestHandlers; use Fisharebest\Webtrees\Http\ViewResponseTrait; use Fisharebest\Webtrees\I18N; use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ServerRequestInterface; use Psr\Http\Server\RequestHandlerInterface; use function ob_get_clean; use function ob_start; use function phpinfo; use function preg_match; use const INFO_ALL; use const INFO_CREDITS; use const INFO_LICENSE; /** * Show PHP information. */ class PhpInformation implements RequestHandlerInterface { use ViewResponseTrait; /** * @param ServerRequestInterface $request * * @return ResponseInterface */ public function handle(ServerRequestInterface $request): ResponseInterface { $this->layout = 'layouts/administration'; ob_start(); phpinfo(INFO_ALL & ~INFO_CREDITS & ~INFO_LICENSE); $phpinfo = ob_get_clean(); preg_match('%(.*)%s', $phpinfo, $matches); $phpinfo = $matches[1]; return $this->viewResponse('admin/server-information', [ 'title' => I18N::translate('Server information'), 'phpinfo' => $phpinfo, ]); } }