39726-vm/healthz.php
2026-04-19 01:12:47 +00:00

25 lines
598 B
PHP

<?php
declare(strict_types=1);
require_once __DIR__ . '/app.php';
$checks = [
'php' => PHP_VERSION,
'ffmpeg' => ffmpeg_is_available() ? 'available' : 'missing',
'database' => 'pending',
'time' => gmdate('c'),
];
$statusCode = 200;
try {
app_boot();
$checks['database'] = 'connected';
} catch (Throwable $e) {
$checks['database'] = 'error';
$checks['error'] = $e->getMessage();
$statusCode = 500;
}
http_response_code($statusCode);
header('Content-Type: application/json; charset=utf-8');
echo json_encode($checks, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES);