true, CURLOPT_TIMEOUT=>3, CURLOPT_CONNECTTIMEOUT=>2]); $r = curl_exec($ch); $code = curl_getinfo($ch, CURLINFO_HTTP_CODE); curl_close($ch); $s151 = $code == 200; $models = $r ? array_column(json_decode($r, true)['models'] ?? [], 'name') : []; $checks['s151'] = $s151 ? 'ok' : 'down'; $checks['models'] = $models; // 2. fast.php exists? $checks['fast_php'] = file_exists('/var/www/html/api/weval-ia-fast.php') ? 'ok' : 'missing'; // 3. PHP-FPM workers $workers = (int)shell_exec('pgrep -c php-fpm8.5 2>/dev/null'); $checks['workers'] = $workers; // Overall status $ok = $s151 && $checks['fast_php'] === 'ok' && $workers > 2; $checks['status'] = $ok ? 'ok' : 'degraded'; echo json_encode($checks);