Intervention/image · error · Intervention\Image\Exceptions\FileNotReadableException

Directory "{dirname}" contained in SplFileInfo is not readab

Error message

Directory "{dirname}" contained in SplFileInfo is not readable

What it means

Error "Directory "{dirname}" contained in SplFileInfo is not readable" thrown in Intervention/image.

Source

Thrown at src/Traits/CanParseFilePath.php:113

            throw new DirectoryNotFoundException(
                'The directory "' . $dirname . '" contained in SplFileInfo does not exist',
            );
        }

        if (!file_exists($path)) {
            throw new FileNotFoundException(
                'File "' . $basename . '" contained in SplFileInfo was not found in directory "' . $dirname . '"',
            );
        }

        if (!is_file($path)) {
            throw new FileNotFoundException(
                'File "' . $basename . '" contained in SplFileInfo is no file in directory "' . $dirname . '"',
            );
        }

        if (!is_readable($dirname)) {
            throw new FileNotReadableException(
                'Directory "' . $dirname . '" contained in SplFileInfo is not readable',
            );
        }

        if (!is_readable($path)) {
            throw new FileNotReadableException(
                'File "' . $path . '" contained in SplFileInfo is not readable',
            );
        }

        $realpath = $splFileInfo->getRealPath();

        if ($realpath === false) {
            throw new FileNotReadableException('Failed to read file "' . $path . '" from ' . SplFileInfo::class);
        }

        return $realpath;
    }

View on GitHub (pinned to 5598b9e397)

Solutions

  1. Check the directory permissions (is_readable($dirname)) and fix with chmod/chown
  2. Run the PHP process as a user that can read the directory
  3. Verify the path is not inside a restricted location (open_basedir, container mount)

When it happens

Trigger: Thrown at src/Traits/CanParseFilePath.php:113 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of Intervention/image@5598b9e397 (2026-08-23). Data as JSON: /api/errors/ea94a149cf1eded4. Report an issue: GitHub.