wordpress / error-debug.php
CatPtain's picture
Upload 9 files
efc9636 verified
<?php
/**
* Simple error debugging page for WordPress
*/
// Enable error reporting
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
echo "<h1>WordPress Debug Information</h1>";
// Check PHP version
echo "<h2>PHP Version</h2>";
echo "<p>" . phpversion() . "</p>";
// Check SQLite extension
echo "<h2>SQLite Support</h2>";
if (extension_loaded('pdo_sqlite')) {
echo "<p style='color: green;'>βœ“ PDO SQLite extension is loaded</p>";
} else {
echo "<p style='color: red;'>βœ— PDO SQLite extension is NOT loaded</p>";
}
// Check file permissions
echo "<h2>File Permissions</h2>";
$paths = [
'/var/www/html',
'/var/www/html/wp-content',
'/var/www/html/wp-content/database',
'/var/www/html/wp-content/db.php'
];
foreach ($paths as $path) {
if (file_exists($path)) {
$perms = substr(sprintf('%o', fileperms($path)), -4);
echo "<p>$path: $perms</p>";
} else {
echo "<p style='color: red;'>$path: NOT FOUND</p>";
}
}
// Check database file
echo "<h2>Database Status</h2>";
$db_file = '/var/www/html/wp-content/database/wordpress.db';
if (file_exists($db_file)) {
echo "<p style='color: green;'>βœ“ Database file exists</p>";
echo "<p>Size: " . filesize($db_file) . " bytes</p>";
} else {
echo "<p style='color: red;'>βœ— Database file does not exist</p>";
}
// Test SQLite connection
echo "<h2>SQLite Connection Test</h2>";
try {
$pdo = new PDO('sqlite:' . $db_file);
echo "<p style='color: green;'>βœ“ SQLite connection successful</p>";
} catch (Exception $e) {
echo "<p style='color: red;'>βœ— SQLite connection failed: " . $e->getMessage() . "</p>";
}
// Check WordPress files
echo "<h2>WordPress Files</h2>";
$wp_files = [
'/var/www/html/wp-config.php',
'/var/www/html/wp-settings.php',
'/var/www/html/wp-load.php'
];
foreach ($wp_files as $file) {
if (file_exists($file)) {
echo "<p style='color: green;'>βœ“ $file exists</p>";
} else {
echo "<p style='color: red;'>βœ— $file NOT FOUND</p>";
}
}
echo "<h2>Environment Variables</h2>";
echo "<p>HTTP_HOST: " . ($_SERVER['HTTP_HOST'] ?? 'not set') . "</p>";
echo "<p>SERVER_NAME: " . ($_SERVER['SERVER_NAME'] ?? 'not set') . "</p>";
echo "<p>REQUEST_URI: " . ($_SERVER['REQUEST_URI'] ?? 'not set') . "</p>";
echo "<hr><p><a href='/'>Try WordPress again</a></p>";
?>