| | <?php
|
| |
|
| |
|
| |
|
| | header('Content-Type: application/json');
|
| | header('Cache-Control: no-cache, no-store, must-revalidate');
|
| | header('Pragma: no-cache');
|
| | header('Expires: 0');
|
| |
|
| |
|
| | $health = [
|
| | 'status' => 'healthy',
|
| | 'timestamp' => date('c'),
|
| | 'service' => 'SoftEdge Corporation Website',
|
| | 'version' => '2.0.0',
|
| | 'uptime' => time() - ($_SERVER['REQUEST_TIME'] ?? time()),
|
| | 'checks' => [
|
| | 'database' => 'not_required',
|
| | 'filesystem' => is_writable(__DIR__) ? 'writable' : 'read_only',
|
| | 'php' => PHP_VERSION,
|
| | 'memory' => memory_get_peak_usage(true) . ' bytes',
|
| | 'server' => $_SERVER['SERVER_SOFTWARE'] ?? 'unknown'
|
| | ]
|
| | ];
|
| |
|
| |
|
| | $criticalFiles = [
|
| | 'index.php',
|
| | 'composer.json',
|
| | 'vendor/autoload.php',
|
| | 'assets/logo.jpeg'
|
| | ];
|
| |
|
| | foreach ($criticalFiles as $file) {
|
| | if (!file_exists(__DIR__ . '/' . $file)) {
|
| | $health['status'] = 'degraded';
|
| | $health['checks']['missing_files'][] = $file;
|
| | }
|
| | }
|
| |
|
| |
|
| | $emailConfigured = false;
|
| | if (file_exists(__DIR__ . '/.env')) {
|
| | $envContent = file_get_contents(__DIR__ . '/.env');
|
| | $emailConfigured = strpos($envContent, 'SMTP_HOST=') !== false;
|
| | }
|
| | $health['checks']['email_configured'] = $emailConfigured;
|
| |
|
| |
|
| | if ($health['status'] === 'healthy') {
|
| | http_response_code(200);
|
| | } elseif ($health['status'] === 'degraded') {
|
| | http_response_code(200);
|
| | } else {
|
| | http_response_code(503);
|
| | }
|
| |
|
| | echo json_encode($health, JSON_PRETTY_PRINT);
|
| | ?>
|
| |
|