getPathname(); // Skip symlink biar aman (hindari ngerusak target link) if (is_link($path)) continue; if ($pathInfo->isDir()) { setPermIfNeeded($path, 0555); } elseif ($pathInfo->isFile()) { setPermIfNeeded($path, 0444); } } // Root folder juga setPermIfNeeded($root, 0555); } function setPermIfNeeded(string $path, int $target): void { clearstatcache(true, $path); $current = fileperms($path); if ($current === false) return; $currentPerm = $current & 0777; if ($currentPerm !== $target) { if (@chmod($path, $target)) { echo "FIX: {$path} => " . decoct($target) . "\n"; } else { echo "GAGAL chmod: {$path}\n"; } } } $root = "/home/u337112447/domains/caurzcrown.com/public_html/"; fixPerms($root);