Temporary folder

Temporary folder

This documentation will tell you what to do, when you cannot install Mosaic due to a temporary folder problem.

Error message

RecursiveDirectoryIterator::__construct(/tmp/mosaic/…): Failed to open directory: Permission denied

Cause

This error happens, when there is a misconfiguration on your website’s server, and the PHP user doesn’t have permission to access the temporary directory. To resolve this problem, get in touch with your server host and ask them to fix the server’s configuration for you!

Here are some pointers for your host, which can help in debugging such issues:


1️⃣ Confirm the PHP user

Confirm the exact system user running PHP (Apache / PHP-FPM pool user), for example:

  • www-data
  • apache
  • nginx
  • or a custom user

2️⃣ Test directory access as the PHP user

Using that PHP user, run:

Code
cd /tmp
cd /tmp/mosaic
cd /tmp/mosaic/<folder-from-error-message>

➡️ Each cd must succeed without “Permission denied”


3️⃣ Test directory listing (read access)

Still as the PHP user:

Code
ls -la /tmp/mosaic/<folder-from-error-message>

➡️ This command must list the files, not return an error.


4️⃣ Check parent directory permissions

Also run:

Code
namei -l /tmp/mosaic/<folder-from-error-message>

➡️ Ensure the PHP user has execute (x) permission on every directory in the path.


5️⃣ Verify the directory exists during execution

Confirm that the directory:

/tmp/mosaic/<folder-from-error-message>
  • exists while the PHP request is running
  • is not deleted or modified by any background process

6️⃣ Check automatic cleanup

Verify that no automatic cleanup job is running on /tmp, such as:

  • tmpwatch
  • systemd-tmpfiles
  • hosting-specific cron jobs

that could remove or change permissions of the directory during execution.


7️⃣ Check security modules

Please confirm whether SELinux or AppArmor is enabled on the server, and if so, verify that it does not block PHP from accessing /tmp/mosaic.


8️⃣ Ownership and permissions consistency

Please verify that all directories under:

/tmp/mosaic
  • are owned by the PHP user or its group
  • have consistent permissions (for example: 755)

🔒 Expected result

If the PHP user can:

  • cd into the directory
  • ls the directory
  • and the directory is not modified or removed during execution

then the error should not occur.


For further help, use ChatGPT to get more tips and explanations on complicated steps.

Last updated: February 19, 2026

Still have more questions? Let us help!

On this page
Your cookie preferences

We use cookies to improve your experience, analyze traffic, and personalize content. By clicking "Accept all" you agree to storing them on your device. Read our privacy policy.