'ok', 'timestamp' => time() ]; // Check database connection $dbConnected = false; $dbError = null; try { $conn = @mysqli_connect( 'aide-mariadb', 'aide', 'aide', 'thetool_s13' ); if ($conn) { $dbConnected = true; mysqli_close($conn); } } catch (Exception $e) { $dbError = $e->getMessage(); } if ($dbConnected) { $health['db'] = true; } else { $health['db'] = false; if ($dbError) { $health['db_error'] = $dbError; } } // Set HTTP status code if ($health['db']) { http_response_code(200); } else { http_response_code(503); // Service Unavailable } echo json_encode($health);