Skip to content
Docs

laravel.log could not be opened: Permission denied

On Tanzahost, Laravel's storage folder is a permanent folder your app can write to. Keep storage in your app's permanent folders, and never chmod 777.

Updated 22 Oct 20262 min read

The whole message:

text
The stream or file "storage/logs/laravel.log" could not be opened in append mode: Failed to open stream: Permission denied

The fix on Tanzahost: make sure storage is one of your app's Permanent folders. It is by default for Laravel, so this error almost always means the list was changed and storage left out.

  1. Open the app. Under Build and run, find Permanent folders.

  2. If it's empty, we use Laravel's default, storage. If you typed your own folders there, add storage to them, separated by commas, like storage, public/uploads.

  3. Choose Save and build.

Don't run chmod -R 777 storage. You don't need it here, and it lets any program change your files.

Why it happens

On Tanzahost your app's code is read-only while it runs, so a version can't be changed after it's built, even by someone who breaks into it. Only a few places are writable:

FolderWhat it's forKept across deploys
storage, and any permanent folder you addLaravel's logs, sessions, cache files and uploadsYes. The first deploy fills it from your code, later ones keep what's there.
bootstrap/cacheLaravel's cached config, routes and servicesNo: it starts empty, up to 64 MB, on every start
/tmpShort-lived filesNo

Laravel writes storage/logs/laravel.log as soon as it logs anything. If storage isn't permanent, it's read-only like the rest of the code, and PHP says "Permission denied" or "Read-only file system".

The list you type replaces Laravel's default rather than adding to it. That's how storage usually goes missing: someone adds public/uploads and nothing else. The same goes for permanent in tanzahost.json:

json
{
  "permanent": ["storage", "public/uploads"]
}

How to check

  1. Under Build and run, read Permanent folders.

  2. In the file manager, your app's permanent folders show at the top level, writable. If storage isn't there, it isn't permanent.

  3. If your repository has no storage/logs or storage/framework folders, because a .gitignore left them out, Laravel can't find them either. Laravel's own skeleton keeps them in Git with an empty .gitignore file in each: commit those.