<?php

declare(strict_types=1);

@ini_set('display_errors', '1');
@ini_set('display_startup_errors', '1');
error_reporting(E_ALL);

header('Content-Type: text/plain; charset=utf-8');

echo "PHP PROBE OK\n";
echo "time: " . gmdate('c') . "\n";
echo "php_version: " . PHP_VERSION . "\n";
echo "sapi: " . PHP_SAPI . "\n";
echo "document_root: " . ($_SERVER['DOCUMENT_ROOT'] ?? '(none)') . "\n";
echo "script_filename: " . ($_SERVER['SCRIPT_FILENAME'] ?? '(none)') . "\n";
echo "request_uri: " . ($_SERVER['REQUEST_URI'] ?? '(none)') . "\n";

$baseDir = dirname(__DIR__);
echo "base_dir: " . $baseDir . "\n";
echo ".env_readable: " . (is_readable($baseDir . DIRECTORY_SEPARATOR . '.env') ? 'yes' : 'no') . "\n";
echo "vendor_autoload_exists: " . (is_file($baseDir . DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . 'autoload.php') ? 'yes' : 'no') . "\n";
