Created server-check.php to diagnose server issues: - PHP version check (requires 7.4+) - Extension checks (curl, json, mbstring, openssl, zip) - File permission checks (logs/, vendor/) - Composer dependency verification - Configuration file existence - PHP settings (upload limits, memory) - Service class loading tests Use this to troubleshoot 500 errors on production server. Access: /server-check.php 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
110 lines
3.5 KiB
PHP
110 lines
3.5 KiB
PHP
<?php
|
|
/**
|
|
* Server Environment Check
|
|
* Diagnose server configuration and compatibility
|
|
*/
|
|
|
|
header('Content-Type: text/html; charset=utf-8');
|
|
|
|
echo "<h1>Server Environment Check</h1>";
|
|
|
|
echo "<h2>PHP Version</h2>";
|
|
echo "<p><strong>Version:</strong> " . phpversion() . "</p>";
|
|
echo "<p><strong>Required:</strong> 7.4+</p>";
|
|
echo "<p><strong>Status:</strong> " . (version_compare(phpversion(), '7.4.0', '>=') ? '✅ OK' : '❌ TOO OLD') . "</p>";
|
|
|
|
echo "<h2>PHP Extensions</h2>";
|
|
$requiredExtensions = ['curl', 'json', 'mbstring', 'openssl', 'zip'];
|
|
foreach ($requiredExtensions as $ext) {
|
|
$loaded = extension_loaded($ext);
|
|
echo "<p><strong>{$ext}:</strong> " . ($loaded ? '✅ Loaded' : '❌ Missing') . "</p>";
|
|
}
|
|
|
|
echo "<h2>File Permissions</h2>";
|
|
$dirs = [
|
|
'logs' => __DIR__ . '/logs',
|
|
'vendor' => __DIR__ . '/vendor'
|
|
];
|
|
|
|
foreach ($dirs as $name => $path) {
|
|
$exists = file_exists($path);
|
|
$writable = is_writable($path);
|
|
echo "<p><strong>{$name}/:</strong> ";
|
|
echo $exists ? '✅ Exists' : '❌ Missing';
|
|
echo " | ";
|
|
echo $writable ? '✅ Writable' : '❌ Not Writable';
|
|
echo "</p>";
|
|
}
|
|
|
|
echo "<h2>Composer Dependencies</h2>";
|
|
if (file_exists(__DIR__ . '/vendor/autoload.php')) {
|
|
echo "<p>✅ vendor/autoload.php exists</p>";
|
|
require_once __DIR__ . '/vendor/autoload.php';
|
|
|
|
$classes = [
|
|
'League\Csv\Reader' => 'league/csv',
|
|
'League\Csv\Writer' => 'league/csv',
|
|
'Carbon\Carbon' => 'nesbot/carbon',
|
|
'Firebase\JWT\JWT' => 'firebase/php-jwt'
|
|
];
|
|
|
|
foreach ($classes as $class => $package) {
|
|
$exists = class_exists($class);
|
|
echo "<p><strong>{$package}</strong> ({$class}): " . ($exists ? '✅ Available' : '❌ Missing') . "</p>";
|
|
}
|
|
} else {
|
|
echo "<p>❌ vendor/autoload.php NOT FOUND</p>";
|
|
echo "<p>Run: <code>composer install</code></p>";
|
|
}
|
|
|
|
echo "<h2>Configuration Files</h2>";
|
|
$files = [
|
|
'config.php',
|
|
'43984435_77m2ujl3_config.json',
|
|
'CSVTransformer.php',
|
|
'OMGService.php',
|
|
'EmailService.php',
|
|
'EmailTemplates.php',
|
|
'ApplicationLogger.php'
|
|
];
|
|
|
|
foreach ($files as $file) {
|
|
$exists = file_exists(__DIR__ . '/' . $file);
|
|
echo "<p><strong>{$file}:</strong> " . ($exists ? '✅ Exists' : '❌ Missing') . "</p>";
|
|
}
|
|
|
|
echo "<h2>PHP Configuration</h2>";
|
|
echo "<p><strong>display_errors:</strong> " . ini_get('display_errors') . "</p>";
|
|
echo "<p><strong>error_reporting:</strong> " . error_reporting() . "</p>";
|
|
echo "<p><strong>max_upload:</strong> " . ini_get('upload_max_filesize') . "</p>";
|
|
echo "<p><strong>max_post:</strong> " . ini_get('post_max_size') . "</p>";
|
|
echo "<p><strong>memory_limit:</strong> " . ini_get('memory_limit') . "</p>";
|
|
|
|
echo "<h2>Test Service Loading</h2>";
|
|
try {
|
|
require_once __DIR__ . '/CSVTransformer.php';
|
|
$transformer = new CSVTransformer();
|
|
echo "<p>✅ CSVTransformer: OK</p>";
|
|
} catch (Exception $e) {
|
|
echo "<p>❌ CSVTransformer: " . $e->getMessage() . "</p>";
|
|
}
|
|
|
|
try {
|
|
require_once __DIR__ . '/OMGService.php';
|
|
$omg = new OMGService();
|
|
echo "<p>✅ OMGService: OK</p>";
|
|
} catch (Exception $e) {
|
|
echo "<p>❌ OMGService: " . $e->getMessage() . "</p>";
|
|
}
|
|
|
|
try {
|
|
require_once __DIR__ . '/EmailService.php';
|
|
$email = new EmailService();
|
|
echo "<p>✅ EmailService: OK</p>";
|
|
} catch (Exception $e) {
|
|
echo "<p>❌ EmailService: " . $e->getMessage() . "</p>";
|
|
}
|
|
|
|
echo "<h2>Summary</h2>";
|
|
echo "<p>If all checks pass above, the application should work.</p>";
|
|
echo "<p>If you see errors, fix them and run this check again.</p>";
|