<?php
// /admission333/_health.php
header('Content-Type: text/plain; charset=UTF-8');
error_reporting(E_ALL);
ini_set('display_errors', 1);
session_start();

echo "PHP OK\n";

require 'db.php';
if (!isset($mysqli1) || !($mysqli1 instanceof mysqli)) { die("DB handle \$mysqli1 missing\n"); }
$mysqli1->set_charset('utf8mb4');
$r = $mysqli1->query("SELECT 1 AS ok");
$row = $r->fetch_assoc();
echo "DB OK=" . ($row['ok'] ?? 'no') . "\n";

echo "mail() test: ";
$sent = @mail('postmaster@localhost', 'health', 'ok');
echo $sent ? "ok\n" : "fail\n";

echo "cURL test: ";
if (function_exists('curl_version')) { echo "ok\n"; } else { echo "not installed\n"; }

echo "Done.\n";
