Laravel 500 error after deploy, even with nothing in the log
· The AYT team · 5 min read

When Laravel returns a 500 error right after a deploy and storage/logs/laravel.log is empty, the app usually fails before it can write to its log. The most common causes are an unwritable storage folder, a config cache brought over from another machine, a vendor folder that's missing or built for another PHP version, and an empty APP_KEY. The real message is then in the web server's error log, not the app's.
Where to find the real error
Look in this order:
storage/logs/laravel.log(orlaravel-YYYY-MM-DD.logwith the daily log). If the error is here, the problem is in the code or the data, not the server.- The site's error log, from your hosting panel. PHP errors that stop the app before Laravel boots end up here: missing files, the wrong PHP version, permissions.
- Your app's
/upaddress. Laravel's health route answers 200 when the app boots without exceptions and 500 when it doesn't, so it quickly tells you whether the problem is at boot or in one page.
You can set APP_DEBUG=true in .env for a moment to see the error in the browser, but the error page also shows configuration data. Do it for a few minutes only and set it back to false.
Cause 1: storage or bootstrap/cache isn't writable
Laravel writes to storage (logs, sessions, compiled views) and to bootstrap/cache. If it can't, it can't write the error to the log either. The server log then shows something like The stream or file ".../storage/logs/laravel.log" could not be opened in append mode: Failed to open stream: Permission denied.
This happens after an FTP upload that changed ownership or permissions, or when the deploy skipped storage and the storage/framework/cache, sessions and views folders are missing. Then the error becomes "Please provide a valid cache path".
What to do:
- check that
storage/framework/cache/data,storage/framework/sessions,storage/framework/viewsandstorage/logsexist; storageandbootstrap/cachemust be writable by the user PHP runs as. On hosting where PHP runs as the account's user, 755 for folders and 644 for files are enough.
Cause 2: a config cache copied from another machine
If you ran php artisan config:cache or optimize locally and uploaded bootstrap/cache/config.php too, the app uses the paths and passwords from your computer, like /Users/ana/project/storage. They don't exist on the server, so the app fails at boot.
What to do: delete the .php files in bootstrap/cache (keep .gitignore) and run php artisan optimize on the server once its .env is complete. The same applies if you ran the cache commands in a CI pipeline: build the cache on the server where the app runs, nowhere else.
A subtler error comes from the same place: after config:cache, Laravel no longer reads .env, and any env() call outside the config folder returns null. If an API key is empty only in production, move it into a file in config and read it with config().
Cause 3: vendor is missing or built for another PHP version
Without vendor, the server log shows Failed opening required '.../vendor/autoload.php'. If vendor exists but was installed for a newer PHP than the site's, Composer stops the app with "Composer detected issues in your platform: Your Composer dependencies require a PHP version ">= 8.3.0"".
What to do: run composer install --no-dev on the server or on a machine with the same PHP version, or raise the site's PHP version to the one required. Laravel 13 needs at least PHP 8.3; the full list is in our article on Laravel 12 and 13 requirements.
Cause 4: a missing or wrong APP_KEY
A new .env copied from .env.example has an empty APP_KEY=. The error, "No application encryption key has been specified", usually does reach the log. Generate the key with php artisan key:generate.
Be careful with an app that's already live: a new key logs every user out and makes data encrypted with the old key unreadable. If you must change the key, put the old one in APP_PREVIOUS_KEYS. The other production settings for .env are in our guide to the Laravel .env file.
Cause 5: the database
Two common cases after a first deploy:
DB_CONNECTION=sqliteleft over from.env.example(the default since Laravel 11) gives "Database file at path ... does not exist". Setmysqlormariadband the server's database details.- Migrations that haven't run give
SQLSTATE[42S02]: Base table or view not found. Runphp artisan migrate --force.
These usually do show up in laravel.log, because the app gets far enough to boot.
Checklist after a deploy
.envexists on the server and hasAPP_KEY,APP_ENV=production,APP_DEBUG=falseand the database details.vendoris installed for the site's PHP version.storageandbootstrap/cacheare writable, and thestorage/frameworksubfolders exist.bootstrap/cacheholds no cache from another machine.- Migrations have run, then
php artisan optimizeon the server. /upanswers 200.
Laravel deploys on AYT
On AYT, the Laravel Toolkit runs the deploy on the server, into a new release: it clones the project, links storage and .env from the shared folder, runs the deploy script (by default composer install, an asset build if there's a package.json, php artisan migrate --force and php artisan optimize) and only then switches the site to the new release. If a step fails, the site stays on the release it had.

After the switch, the panel checks the /up route. If it doesn't answer with success, it puts the previous release back; migrations are not reversed. Every deploy keeps its log in the history, and the Roll back button takes you back to the previous release by hand. Read the site's PHP errors on the panel's Errors page.

More on the Laravel tools under apps.
