File size: 3,092 Bytes
efc9636 1fb22f2 efc9636 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 |
<?php
/**
* Simple PHP test file
*/
echo "<h1>PHP Test Page</h1>";
echo "<p>PHP Version: " . phpversion() . "</p>";
echo "<p>Current Time: " . date('Y-m-d H:i:s') . "</p>";
// Test SQLite
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>";
// Test a simple query
$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>";
}
// Test file permissions
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>";
}
}
// Test WordPress database methods
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>";
// Test required methods
$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>";
}
}
// Test properties
$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>";
?> |