Permission denied on Laravel's storage or bootstrap/cache folders is one of those errors that looks small and wastes an entire evening. Uploads fail, sessions do not stick, pages break after a deploy, The fix is almost always ownership, not the permission number — and the most common advice on the internet, chmod 777, is the wrong answer.

Why does Laravel need write access to these folders?

Laravel is not a set of static pages. Every request writes something: a session file when a user logs in, a compiled view the first time a page renders, a cache entry, a log line when something goes wrong. The storage folder holds logs, sessions, cached data and uploaded files. The bootstrap/cache folder holds the compiled configuration, routes and services that Laravel loads on every request.

When PHP cannot write to either folder, different things break in different ways. A read-only storage folder means uploads fail, users get logged out between pages because sessions cannot be saved, and the error log stays empty exactly when you need it most. A read-only bootstrap/cache folder means cache commands fail, and a deploy that rebuilds the cache can leave the site down.

The rule: the user account that runs PHP must be able to write to storage and bootstrap/cache, including everything inside them. Everything else can stay read-only.

How do I find out who should own the folders?

Before you change anything, find out which user runs PHP on your server, because that is the account that needs write access. On a VPS, run ps aux | grep php-fpm and look at the user in the first column — it is usually www-data on Ubuntu or nginx or apache on other setups. On cPanel shared hosting, PHP usually runs as your own cPanel username, which is why 755 often works there without any group changes.

Then check who owns the folders now. Run ls -ld storage bootstrap/cache in your project root. If the owner is root and PHP runs as www-data, you have found your problem: the folders were created or uploaded as root, and the web server user has no right to write into them.

That is why changing the permission number alone often does not help. A folder set to 755 owned by root is still read-only for www-data. People then try 777, which works — and makes the folder writable by every account on the server.

What are the correct permissions for Laravel folders?

For a standard install, use 755 for directories, 644 for files, and 775 for the two writable directories — storage and bootstrap/cache — with the group set to the web server user. The 775 gives the owner and the group write access, while everyone else can only read.

PathDirectoriesFilesOwner / group
Project root and app code755644Your deploy user
storage and everything inside775664Your user : web group
bootstrap/cache775664Your user : web group
public755644Your deploy user
.env—600 or 640Your user : web group

How do I fix ownership and permissions on a VPS?

From your project root on a VPS, the fix is four commands. First, give the folders to the web server group — on Ubuntu that group is usually www-data, so run sudo chown -R $USER:www-data storage bootstrap/cache. Second, set directories to 775 and files to 664 inside those two folders: sudo find storage bootstrap/cache -type d -exec chmod 775 {} \; and sudo find storage bootstrap/cache -type f -exec chmod 664 {} \;.

Then clear the caches and let Laravel rebuild them as the correct user: php artisan config:clear, php artisan cache:clear and php artisan view:clear. If you run artisan as root after fixing ownership as www-data, the cache files it creates will be root-owned again, and the web server will be locked out of them on the next request. Run artisan as the same user that owns the project.

If you are on a server with SELinux enabled — common on CentOS, RHEL and AlmaLinux — permissions can be correct and still fail. Check with getenforce. If it returns Enforcing, the folders need the right SELinux context: sudo chcon -R -t httpd_sys_rw_content_t storage bootstrap/cache.

How do I fix it on cPanel shared hosting?

On cPanel you usually do not have SSH as root, and you do not need it. Open File Manager, navigate to your project, right-click the storage folder, choose Change Permissions, and set it to 775. Apply it to subfolders and files as well. Do the same for bootstrap/cache.

If 775 does not fix it, the cause is usually that the folders were uploaded under a different owner, for example by extracting a zip through a different account. In that case, delete the storage subfolders and let Laravel recreate them, or ask your host's support to chown the project to your cPanel username. Most hosts will do this in one ticket, because it is a routine request.

Why does the error keep coming back after every deploy?

If the fix works for a day and the error returns after each deploy, something in your deploy process is resetting ownership. The usual suspects, in order:

  • Deploying or extracting files as root over SSH, so every new file is root-owned
  • Running php artisan config:cache as root, so the cached config in bootstrap/cache is root-owned
  • A deploy script that runs chmod -R 755 over the whole project, wiping the 775 on storage
  • Uploading a fresh zip that replaces the storage folder entirely, losing the group and setgid bits
  • A cron job running artisan commands as a different user than the web server

The durable fix is to deploy as one consistent user and put the permission commands at the end of your deploy script, after the files are in place. Set the group and the 775 on storage and bootstrap/cache last, every time.

If your install is fresh and you are still fighting the server rather than the code, start from the beginning with our guide on how to install a Laravel script on cPanel shared hosting. A 500 error after upload is often the same root cause wearing a different message — our 500 error checklist walks through it.

When should I ask the host or support instead?

Ask your host when the permissions look right and writes still fail, or when you suspect SELinux or a server-level restriction you cannot see. Send them the exact error line from storage/logs/laravel.log, the output of ls -ld storage bootstrap/cache, and the PHP user from your phpinfo or process list.

Every product on codelist ships with full unencrypted source code and an installation guide, plus lifetime free updates, If you bought a product from us and the folders keep fighting you, reach out on WhatsApp at +92 333 4916432 or by email at contact@zqdevelopers.com. Browse the full catalogue if you are still choosing a product. A refund applies if a product is materially broken and cannot be fixed, within 14 days.