diff --git a/debug_paths.php b/debug_paths.php index 006dcb7..5dc6a59 100644 --- a/debug_paths.php +++ b/debug_paths.php @@ -5,15 +5,24 @@ echo "ROOT_PATH: " . ROOT_PATH . PHP_EOL; echo "STORAGE_PATH: " . STORAGE_PATH . PHP_EOL; echo "Is STORAGE_PATH dir? " . (is_dir(STORAGE_PATH) ? 'YES' : 'NO') . PHP_EOL; echo "Is STORAGE_PATH writable? " . (is_writable(STORAGE_PATH) ? 'YES' : 'NO') . PHP_EOL; -echo "Current User: " . get_current_user() . PHP_EOL; -echo "PHP User: " . exec('whoami') . PHP_EOL; +echo "STORAGE Permissions: " . substr(sprintf('%o', fileperms(STORAGE_PATH)), -4) . PHP_EOL; +echo "STORAGE Owner: " . posix_getpwuid(fileowner(STORAGE_PATH))['name'] . PHP_EOL; -$testDir = STORAGE_PATH . '/test_mkdir_' . time(); -if (mkdir($testDir, 0777, true)) { - echo "Successfully created test dir: $testDir" . PHP_EOL; +$invoicesDir = STORAGE_PATH . '/invoices'; +echo "Invoices Dir exists? " . (is_dir($invoicesDir) ? 'YES' : 'NO') . PHP_EOL; +if (is_dir($invoicesDir)) { + echo "Invoices Writable? " . (is_writable($invoicesDir) ? 'YES' : 'NO') . PHP_EOL; + echo "Invoices Permissions: " . substr(sprintf('%o', fileperms($invoicesDir)), -4) . PHP_EOL; + echo "Invoices Owner: " . posix_getpwuid(fileowner($invoicesDir))['name'] . PHP_EOL; +} + +echo "Current PHP Process User (whoami): " . exec('whoami') . PHP_EOL; + +$testDir = STORAGE_PATH . '/test_browser_' . time(); +if (@mkdir($testDir, 0777, true)) { + echo "SUCCESS: Created $testDir" . PHP_EOL; rmdir($testDir); } else { - echo "FAILED to create test dir: $testDir" . PHP_EOL; - $err = error_get_last(); - echo "Error: " . ($err['message'] ?? 'Unknown') . PHP_EOL; + echo "FAILURE: Could not create $testDir" . PHP_EOL; + print_r(error_get_last()); }