39478-vm/healthz.php
2026-04-05 11:51:30 +00:00

23 lines
618 B
PHP

<?php
declare(strict_types=1);
header('Content-Type: application/json; charset=utf-8');
require_once __DIR__ . '/db/config.php';
try {
db()->query('SELECT 1');
http_response_code(200);
echo json_encode([
'status' => 'ok',
'app' => 'lamp-store-admin',
'time' => gmdate('c'),
], JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
} catch (Throwable $exception) {
http_response_code(500);
echo json_encode([
'status' => 'error',
'message' => 'database_unreachable',
'time' => gmdate('c'),
], JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
}