Add server diagnostic script for debugging 500 errors
Created server-check.php to diagnose deployment issues: CHECKS: ✓ PHP version and server info ✓ Composer vendor/ directory exists ✓ Firebase JWT library installed ✓ config.php exists ✓ .env file exists ✓ All critical PHP files present ✓ Directory permissions (uploads/) ✓ Test loads env_loader.php ✓ Test loads config.php ✓ Test loads AuthMiddleware.php ✓ Shows specific errors if files fail to load USAGE: Visit: https://your-server.com/nano-pro/server-check.php Shows: - What's missing or broken - Exact error messages - Action items to fix - Deployment checklist Perfect for diagnosing 500 errors without SSH access! 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
3c3523d960
commit
20f1a16bb0
1 changed files with 152 additions and 0 deletions
152
server-check.php
Normal file
152
server-check.php
Normal file
|
|
@ -0,0 +1,152 @@
|
|||
<?php
|
||||
/**
|
||||
* Server Diagnostic Script
|
||||
* Visit this page to see what's wrong with the deployment
|
||||
*/
|
||||
|
||||
header('Content-Type: text/html; charset=utf-8');
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Server Diagnostic - Nano Banana Pro</title>
|
||||
<style>
|
||||
body { font-family: monospace; background: #000; color: #0f0; padding: 20px; }
|
||||
.section { background: #1a1a1a; padding: 15px; margin: 10px 0; border-left: 4px solid #0f0; }
|
||||
.error { border-left-color: #f00; color: #f00; }
|
||||
.warning { border-left-color: #ff0; color: #ff0; }
|
||||
.success { border-left-color: #0f0; color: #0f0; }
|
||||
h1 { color: #0ff; }
|
||||
h2 { color: #ff0; }
|
||||
pre { margin: 5px 0; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1>=== NANO BANANA PRO SERVER DIAGNOSTIC ===</h1>
|
||||
|
||||
<div class="section">
|
||||
<h2>1. PHP Information</h2>
|
||||
<pre>PHP Version: <?php echo phpversion(); ?></pre>
|
||||
<pre>Server: <?php echo $_SERVER['SERVER_SOFTWARE'] ?? 'Unknown'; ?></pre>
|
||||
<pre>Document Root: <?php echo $_SERVER['DOCUMENT_ROOT'] ?? 'Unknown'; ?></pre>
|
||||
<pre>Current Directory: <?php echo __DIR__; ?></pre>
|
||||
</div>
|
||||
|
||||
<div class="section <?php echo file_exists(__DIR__ . '/vendor') ? 'success' : 'error'; ?>">
|
||||
<h2>2. Composer Dependencies (vendor/)</h2>
|
||||
<?php if (file_exists(__DIR__ . '/vendor')): ?>
|
||||
<pre>✓ vendor/ directory EXISTS</pre>
|
||||
<pre>✓ Autoload: <?php echo file_exists(__DIR__ . '/vendor/autoload.php') ? 'EXISTS' : 'MISSING'; ?></pre>
|
||||
<pre>✓ Firebase JWT: <?php echo file_exists(__DIR__ . '/vendor/firebase') ? 'INSTALLED' : 'MISSING'; ?></pre>
|
||||
<?php else: ?>
|
||||
<pre>✗ vendor/ directory MISSING</pre>
|
||||
<pre>✗ FIX: Run 'composer install' on the server</pre>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
<div class="section <?php echo file_exists(__DIR__ . '/config.php') ? 'success' : 'error'; ?>">
|
||||
<h2>3. Configuration Files</h2>
|
||||
<pre>config.php: <?php echo file_exists(__DIR__ . '/config.php') ? '✓ EXISTS' : '✗ MISSING'; ?></pre>
|
||||
<pre>.env: <?php echo file_exists(__DIR__ . '/.env') ? '✓ EXISTS' : '⚠ MISSING (optional)'; ?></pre>
|
||||
<pre>.env.example: <?php echo file_exists(__DIR__ . '/.env.example') ? '✓ EXISTS' : '✗ MISSING'; ?></pre>
|
||||
</div>
|
||||
|
||||
<div class="section">
|
||||
<h2>4. Critical Files Check</h2>
|
||||
<?php
|
||||
$criticalFiles = [
|
||||
'index.php',
|
||||
'api.php',
|
||||
'auth.php',
|
||||
'AuthMiddleware.php',
|
||||
'JWTValidator.php',
|
||||
'session_manager.php',
|
||||
'env_loader.php',
|
||||
'enhance_prompt.php'
|
||||
];
|
||||
foreach ($criticalFiles as $file):
|
||||
?>
|
||||
<pre><?php echo $file; ?>: <?php echo file_exists(__DIR__ . '/' . $file) ? '✓' : '✗ MISSING'; ?></pre>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
|
||||
<div class="section">
|
||||
<h2>5. Directory Permissions</h2>
|
||||
<?php
|
||||
$uploads = __DIR__ . '/uploads';
|
||||
$sessions = __DIR__ . '/uploads/sessions';
|
||||
?>
|
||||
<pre>uploads/: <?php echo is_dir($uploads) ? (is_writable($uploads) ? '✓ Writable' : '⚠ Not writable') : '✗ Missing'; ?></pre>
|
||||
<pre>uploads/sessions/: <?php echo is_dir($sessions) ? (is_writable($sessions) ? '✓ Writable' : '⚠ Not writable') : '✗ Missing'; ?></pre>
|
||||
</div>
|
||||
|
||||
<div class="section">
|
||||
<h2>6. Testing File Loads</h2>
|
||||
<?php
|
||||
echo "<pre>Testing env_loader.php...</pre>";
|
||||
try {
|
||||
if (file_exists(__DIR__ . '/env_loader.php')) {
|
||||
require_once __DIR__ . '/env_loader.php';
|
||||
echo "<pre class='success'>✓ env_loader.php loaded successfully</pre>";
|
||||
} else {
|
||||
echo "<pre class='error'>✗ env_loader.php missing</pre>";
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
echo "<pre class='error'>✗ Error: " . htmlspecialchars($e->getMessage()) . "</pre>";
|
||||
}
|
||||
|
||||
echo "<pre>Testing config.php...</pre>";
|
||||
try {
|
||||
if (file_exists(__DIR__ . '/config.php')) {
|
||||
require_once __DIR__ . '/config.php';
|
||||
echo "<pre class='success'>✓ config.php loaded successfully</pre>";
|
||||
echo "<pre> GEMINI_API_KEY: " . (defined('GEMINI_API_KEY') && !empty(GEMINI_API_KEY) ? '✓ SET' : '✗ NOT SET') . "</pre>";
|
||||
echo "<pre> SSO_ENABLED: " . (defined('SSO_ENABLED') ? (SSO_ENABLED ? 'TRUE' : 'FALSE') : '✗ NOT SET') . "</pre>";
|
||||
} else {
|
||||
echo "<pre class='error'>✗ config.php missing</pre>";
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
echo "<pre class='error'>✗ Error: " . htmlspecialchars($e->getMessage()) . "</pre>";
|
||||
}
|
||||
|
||||
echo "<pre>Testing AuthMiddleware.php...</pre>";
|
||||
try {
|
||||
if (file_exists(__DIR__ . '/AuthMiddleware.php')) {
|
||||
require_once __DIR__ . '/AuthMiddleware.php';
|
||||
echo "<pre class='success'>✓ AuthMiddleware.php loaded successfully</pre>";
|
||||
} else {
|
||||
echo "<pre class='error'>✗ AuthMiddleware.php missing</pre>";
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
echo "<pre class='error'>✗ Error: " . htmlspecialchars($e->getMessage()) . "</pre>";
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
|
||||
<div class="section">
|
||||
<h2>7. Next Steps</h2>
|
||||
<?php if (!file_exists(__DIR__ . '/vendor')): ?>
|
||||
<pre class="error">ACTION REQUIRED: Run 'composer install' on the server</pre>
|
||||
<?php endif; ?>
|
||||
<?php if (!file_exists(__DIR__ . '/config.php')): ?>
|
||||
<pre class="error">ACTION REQUIRED: Copy config.example.php to config.php and add API key</pre>
|
||||
<?php endif; ?>
|
||||
<?php if (file_exists(__DIR__ . '/vendor') && file_exists(__DIR__ . '/config.php')): ?>
|
||||
<pre class="success">✓ All critical files present - check error logs for specific PHP error</pre>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
<h2>Deployment Checklist:</h2>
|
||||
<pre>
|
||||
1. git pull origin master
|
||||
2. composer install
|
||||
3. cp config.example.php config.php
|
||||
4. Edit config.php (add Gemini API key)
|
||||
5. cp .env.example .env
|
||||
6. mkdir -p uploads/sessions
|
||||
7. chmod 755 uploads/sessions
|
||||
8. Visit index.php
|
||||
</pre>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
Loading…
Add table
Reference in a new issue