echo "
🧪 UniFi Portal Directory Test
";
// Current working directory
echo "";
echo "Current Working Directory (getcwd()):
";
echo "" . getcwd() . "";
echo "
";
// __FILE__ constant
echo "";
echo "Full Path to This Script (__FILE__):
";
echo "" . __FILE__ . "";
echo "
";
// __DIR__ constant
echo "";
echo "Directory of This Script (__DIR__):
";
echo "" . __DIR__ . "";
echo "
";
// Check if we're in public_html
$currentDir = getcwd();
if (strpos($currentDir, 'public_html') !== false) {
echo "";
echo "✓ SUCCESS: This script is running in the public_html directory!";
echo "
";
} else {
echo "";
echo "âš Note: This script does NOT appear to be in public_html. It's in: " . $currentDir . "";
echo "
";
}
// Server information
echo "";
echo "
Server Information:";
echo "
";
echo "| Property | Value |
";
echo "| HTTP_HOST | " . ($_SERVER['HTTP_HOST'] ?? 'Not set') . " |
";
echo "| REQUEST_URI | " . ($_SERVER['REQUEST_URI'] ?? 'Not set') . " |
";
echo "| SERVER_ADDR | " . ($_SERVER['SERVER_ADDR'] ?? 'Not set') . " |
";
echo "| REMOTE_ADDR | " . ($_SERVER['REMOTE_ADDR'] ?? 'Not set') . " |
";
echo "| PHP_VERSION | " . phpversion() . " |
";
echo "
";
echo "
";
// Directory listing
echo "";
echo "
Contents of Current Directory:";
$files = scandir(getcwd());
if ($files) {
echo "
";
echo "| Name | Type |
";
foreach ($files as $file) {
if ($file === '.' || $file === '..') continue;
$isDir = is_dir(getcwd() . '/' . $file) ? 'Directory' : 'File';
echo "$file | $isDir |
";
}
echo "
";
} else {
echo "Could not read directory";
}
echo "
";
echo "";
echo "