Skip to content
PHP and Laravel3 min read

Laravel 500 error caused by storage and bootstrap/cache permissions

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

Short answer

Laravel throws a 500 error when it can't write to storage or bootstrap/cache, and then fails even to log the error. Make sure the required folders exist, set their permissions with chmod -R 775 storage bootstrap/cache, and clear stale cache files with php artisan optimize:clear.

ArabyHost teamLast updated: ShareWhatsAppXLinkedIn
Contents
  1. What the error means
  2. Common causes
  3. How to fix it
  4. Prevention
  5. On ArabyHost

Laravel constantly writes to two places: storage for logs, sessions, cache and compiled views, and bootstrap/cache for files that speed up booting. If it can’t write there, the app stops with a 500 error, often a blank page, because Laravel couldn’t even write the error to its log.

What the error means

The best-known message says the laravel.log file can’t be opened for appending. The same problem also shows up as:

file_put_contents(/home/user/myapp/storage/framework/views/5f1c.php): Failed to open stream: Permission denied
The /home/user/myapp/bootstrap/cache directory must be present and writable.

All of them mean the user running PHP can’t write to that path, or the path doesn’t exist at all.

Common causes

  • Permissions on storage or bootstrap/cache don’t allow writing, such as 644 on a folder.
  • Folders missing after deploy: some ZIP tools skip empty folders, so the project arrives without storage/framework/sessions or views.
  • Files owned by another user after moving the project from a previous server.
  • A bootstrap/cache/config.php uploaded from your machine, pointing at local paths that don’t exist on the server.
  • The account’s disk is full, so creating any new file fails; see disk quota exceeded.

How to fix it

  1. Read the path in the message: find it in cPanel under Metrics › Errors or in the error_log file. If the path is from your computer rather than the server, skip to step 4.
  2. Over SSH (AI/Developer plans): from the project folder, create any missing folders and set permissions:
cd ~/myapp
mkdir -p storage/framework/{cache/data,sessions,views} storage/logs bootstrap/cache
chmod -R 775 storage bootstrap/cache
php artisan optimize:clear

optimize:clear clears the config, route, view and event caches in one go. The chmod calculator explains the permission values. 3. Without SSH: in Files › File Manager, check that these folders exist and create any missing ones with + Folder:

storage/app/public
storage/framework/cache/data
storage/framework/sessions
storage/framework/views
storage/logs
bootstrap/cache

Then select each one, choose Permissions and set 775. File Manager’s Permissions action doesn’t apply to nested folders, so repeat it for each. 4. Delete stale cache files in bootstrap/cache: config.php, routes-v7.php, services.php and packages.php, keeping .gitignore. Laravel rebuilds what it needs automatically. 5. Check ownership: if File Manager shows the files are owned by someone other than your account, which happens after some migrations, permissions alone won’t fix it. Contact support to correct ownership. 6. Reload the page. If the error changes to something else, Laravel can now log again: read storage/logs/laravel.log for the next step, such as the missing encryption key error.

Prevention

  • Add the mkdir -p and chmod commands to your deploy steps after every Git pull.
  • Don’t upload bootstrap/cache/*.php or storage/logs from your machine; keep them in .gitignore.
  • Use LOG_CHANNEL=daily so the log is split into one file per day instead of one file growing until it fills the disk.
  • Avoid 777 entirely; see file permissions explained.

On ArabyHost

Point the domain’s document root to the project’s public folder, so storage and .env stay outside the web root. AI/Developer plans include SSH jailed in CageFS with Composer and Git for the commands above; on other plans you use File Manager and cPanel’s Git deployment. The Araby AI assistant reads the error log and tells you which folder needs write access. Details are in the Laravel deployment guide and Laravel hosting.

FAQ

Should I set storage to 777?

No. 777 lets any process on the server write to your files, and you don't need it when PHP runs as your account user. 775 on folders is enough, and 755 works on many hosts.

Why does the message show a path from my computer, like C:\laragon?

bootstrap/cache/config.php was uploaded from your machine and contains local paths. Delete it or run php artisan config:clear, and Laravel goes back to the correct server paths.

Can I fix permissions without SSH?

Yes, in cPanel File Manager, but its Permissions action only applies to the selected items, not their contents. Set each subfolder inside storage separately.

Useful? Share it with someone who needs it:WhatsAppXLinkedIn

Read next

Ready to put your idea online?

Fast, isolated hosting, support that understands you, and an AI assistant that fixes problems with you.