-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patherror_monitor.php
More file actions
49 lines (45 loc) · 1.94 KB
/
error_monitor.php
File metadata and controls
49 lines (45 loc) · 1.94 KB
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
<?php
echo "<h1>Stratnova PHP Error Monitor</h1>";
echo "<p>Server IP: " . $_SERVER["SERVER_ADDR"] . "</p>";
echo "<p>Current Time: " . date("Y-m-d H:i:s") . "</p>";
echo "<h2>PHP Configuration Status</h2>";
echo "<table border=\"1\" style=\"border-collapse: collapse; margin: 10px 0;\">";
echo "<tr><th>Setting</th><th>Value</th></tr>";
echo "<tr><td>PHP Version</td><td>" . PHP_VERSION . "</td></tr>";
echo "<tr><td>Error Reporting</td><td>" . error_reporting() . " (E_ALL = " . E_ALL . ")</td></tr>";
echo "<tr><td>Display Errors</td><td>" . (ini_get("display_errors") ? "ON" : "OFF") . "</td></tr>";
echo "<tr><td>Display Startup Errors</td><td>" . (ini_get("display_startup_errors") ? "ON" : "OFF") . "</td></tr>";
echo "<tr><td>Log Errors</td><td>" . (ini_get("log_errors") ? "ON" : "OFF") . "</td></tr>";
echo "<tr><td>Error Log Path</td><td>" . ini_get("error_log") . "</td></tr>";
echo "</table>";
echo "<h2>Recent Error Log (Last 20 lines)</h2>";
$error_log = "/var/www/html/logs/php_errors.log";
if (file_exists($error_log)) {
$lines = file($error_log);
$recent_lines = array_slice($lines, -20);
echo "<pre style=\"background: #f0f0f0; padding: 10px; border: 1px solid #ccc;\">";
foreach ($recent_lines as $line) {
echo htmlspecialchars($line);
}
echo "</pre>";
} else {
echo "<p>No error log file found.</p>";
}
echo "<h2>Admin Error Log</h2>";
$admin_error_log = "/var/www/html/logs/admin_php_errors.log";
if (file_exists($admin_error_log)) {
$lines = file($admin_error_log);
$recent_lines = array_slice($lines, -10);
echo "<pre style=\"background: #ffe0e0; padding: 10px; border: 1px solid #ffcccc;\">";
foreach ($recent_lines as $line) {
echo htmlspecialchars($line);
}
echo "</pre>";
} else {
echo "<p>No admin error log file found.</p>";
}
echo "<h2>Test Error Generation</h2>";
echo "<p>Generating test error...</p>";
$test_undefined = $this_will_generate_error;
echo "<p>Test completed.</p>";
?>