|
<?php |
|
|
|
|
|
|
|
|
|
echo "<h1>PHP Test Page</h1>"; |
|
echo "<p>PHP Version: " . phpversion() . "</p>"; |
|
echo "<p>Current Time: " . date('Y-m-d H:i:s') . "</p>"; |
|
|
|
|
|
if (extension_loaded('pdo_sqlite')) { |
|
echo "<p style='color: green;'>β SQLite PDO extension is available</p>"; |
|
|
|
try { |
|
$db_file = '/var/www/html/wp-content/database/wordpress.db'; |
|
$pdo = new PDO('sqlite:' . $db_file); |
|
echo "<p style='color: green;'>β SQLite connection successful</p>"; |
|
|
|
|
|
$result = $pdo->query("SELECT name FROM sqlite_master WHERE type='table'"); |
|
$tables = $result->fetchAll(PDO::FETCH_COLUMN); |
|
|
|
if (count($tables) > 0) { |
|
echo "<p>Database tables found: " . implode(', ', $tables) . "</p>"; |
|
} else { |
|
echo "<p>No tables found in database (this is normal for a fresh install)</p>"; |
|
} |
|
|
|
} catch (Exception $e) { |
|
echo "<p style='color: red;'>β SQLite connection failed: " . $e->getMessage() . "</p>"; |
|
} |
|
} else { |
|
echo "<p style='color: red;'>β SQLite PDO extension is NOT available</p>"; |
|
} |
|
|
|
|
|
echo "<h2>File Permissions</h2>"; |
|
$files = [ |
|
'/var/www/html/wp-config.php', |
|
'/var/www/html/wp-content/db.php', |
|
'/var/www/html/wp-content/database' |
|
]; |
|
|
|
foreach ($files as $file) { |
|
if (file_exists($file)) { |
|
$perms = substr(sprintf('%o', fileperms($file)), -4); |
|
echo "<p>$file: $perms</p>"; |
|
} else { |
|
echo "<p style='color: red;'>$file: NOT FOUND</p>"; |
|
} |
|
} |
|
|
|
|
|
echo "<h2>WordPress Database Methods Test</h2>"; |
|
if (file_exists('/var/www/html/wp-content/db.php')) { |
|
require_once('/var/www/html/wp-content/db.php'); |
|
|
|
if (class_exists('SQLite_DB')) { |
|
$test_db = new SQLite_DB(); |
|
|
|
echo "<p>β SQLite_DB class loaded successfully</p>"; |
|
|
|
|
|
$methods = ['set_prefix', 'get_results', 'get_row', 'get_var', 'prepare', 'insert', 'update', 'delete']; |
|
foreach ($methods as $method) { |
|
if (method_exists($test_db, $method)) { |
|
echo "<p style='color: green;'>β Method $method exists</p>"; |
|
} else { |
|
echo "<p style='color: red;'>β Method $method missing</p>"; |
|
} |
|
} |
|
|
|
|
|
$properties = ['prefix', 'posts', 'users', 'options', 'ready', 'field_types']; |
|
foreach ($properties as $prop) { |
|
if (property_exists($test_db, $prop)) { |
|
echo "<p style='color: green;'>β Property $prop exists</p>"; |
|
} else { |
|
echo "<p style='color: red;'>β Property $prop missing</p>"; |
|
} |
|
} |
|
|
|
} else { |
|
echo "<p style='color: red;'>β SQLite_DB class not found</p>"; |
|
} |
|
} else { |
|
echo "<p style='color: red;'>β wp-content/db.php not found</p>"; |
|
} |
|
|
|
echo "<hr>"; |
|
echo "<p><a href='/'>Try WordPress</a> | <a href='/debug.php'>Debug Info</a></p>"; |
|
?> |