Laravel shows HTTP ERROR 500 and a blank page, with no message
HTTP ERROR 500 and an empty page, with no Laravel error screenShort answer
A bare 500 means Laravel failed before it could show its own error page, and production hides details on purpose. Read the log file, not the browser. After a fresh deploy the cause is usually one of four: no .env or APP_KEY, a stale config cache, a storage or bootstrap/cache folder the web user cannot write, or a PHP version below the framework's minimum.
Fix it fast
1Find out which cause you have
Do not turn APP_DEBUG on for a public site, because the docs warn it can expose sensitive configuration. Read the newest log lines on the server instead. They name the exception and the file.
tail -n 50 storage/logs/laravel.log php artisan about2Match what you see, then jump to its fix
- 1
No application encryption key has been specified.There is no .env file, or APP_KEY is emptyFix - 2
The app worked until config:cache ran during the deploy, and changes to .env make no differenceA stale configuration cache hides your new .env valuesFix - 3
The log file is empty or cannot be created, and the 500 comes on every requestThe web server user cannot write to storage or bootstrap/cacheFix - 4
The site fails at once, and the command-line PHP is newer than the one the web server usesThe PHP that serves the site is below the framework's minimumFix
- 1
What does the error look like?
HTTP ERROR 500 and an empty page, with no Laravel error screenNo application encryption key has been specified.The site works on your machine and returns 500 right after being deployed
Cause 1 of 4
There is no .env file, or APP_KEY is empty
1Check
A new Laravel project gets its .env by copying .env.example, and the .env file is not committed to source control, so a fresh server has none. Laravel needs the key option from config/app.php, which is driven by APP_KEY, before it can encrypt cookies and sessions.
ls -la .env
grep "^APP_KEY=" .env2Fix
Create the file from the example, fill in your real values, and generate the key with the Artisan command.
cp .env.example .env
php artisan key:generate3Verify
Reload the page. The 500 is gone, and the log shows no new exception.
grep "^APP_KEY=" .env
tail -n 5 storage/logs/laravel.logConfirmed by laravel.com
Cause 2 of 4
A stale configuration cache hides your new .env values
1Check
Once the configuration is cached, the .env file is no longer loaded, and env() calls outside the config files return null. A database host or key that was null at caching time keeps failing.
php artisan config:show app2Fix
Clear the cache, fix the values, and cache again only after the .env is correct. Call env() only inside config files.
php artisan config:clear
# edit .env, then
php artisan config:cache3Verify
Run the config command again and read the values Laravel really uses, then reload the site.
php artisan config:show appConfirmed by laravel.com
Cause 3 of 4
The web server user cannot write to storage or bootstrap/cache
1Check
Laravel writes to the storage and bootstrap/cache directories, so the user that runs the web server must be allowed to write there. Compare the owner of these folders with the user of PHP-FPM or Apache.
ls -ld storage bootstrap/cache
ps -o user= -C php-fpm8.3 | sort -u2Fix
Give the web server user ownership, or write permission, on both directories.
sudo chown -R www-data:www-data storage bootstrap/cache
sudo chmod -R ug+rwx storage bootstrap/cache3Verify
Reload the site. The log file is now created and new entries appear in it.
ls -l storage/logs/Confirmed by laravel.com
Cause 4 of 4
The PHP that serves the site is below the framework's minimum
1Check
Laravel 12 requires PHP 8.2 or newer plus a list of extensions, including mbstring, openssl, pdo, tokenizer, xml, ctype, fileinfo and curl. The command line and the web server can run different PHP versions, so test with the version your web server really uses.
php -v
php -m | grep -E "mbstring|openssl|pdo|tokenizer|xml|ctype|fileinfo|curl"2Fix
Point the web server at a supported PHP version and install the missing extensions for that same version, then restart PHP-FPM or Apache.
sudo apt install php8.3-fpm php8.3-mbstring php8.3-xml php8.3-curl
sudo systemctl restart php8.3-fpm3Verify
Request the site again, and check the log for new errors.
curl -I https://example.comConfirmed by laravel.com
How do I stop it coming back?
- Keep APP_DEBUG=false in production and read errors from the log, or from a log service, instead.
- Make the deploy script copy or create .env, run key:generate only on first install, and run config:cache last.
- Give the deploy user and the web server user a shared group, so new files in storage stay writable.
- Add the framework's health route to your uptime monitor. It returns 200 when the app boots and 500 when it does not.
Sources
How was this page made?
I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.
Which stack is behind this page?
Projects of mine built on the same technologies:
Related fixes
Back end
Laravel env() returns null even though the value is in .env
config('services.my_api.key') returns null
Once you run php artisan config:cache, Laravel stops loading .env, so env() only sees real system variables.
4 causes, each with a fixBack end
Laravel says the bootstrap/cache directory must be present and writable
The /var/www/app/bootstrap/cache directory must be present and writable.
Laravel writes its package manifest into bootstrap/cache and throws when that folder is missing or the current user cannot write to it.
2 causes, each with a fixBack end
Laravel cannot write its log file or the storage folder
The stream or file "/var/www/app/storage/logs/laravel.log" could not be opened: failed to open stream: Permission denied
The user that runs PHP (php-fpm or Apache, often www-data) cannot write to storage or bootstrap/cache.
4 causes, each with a fixServers
Laravel returns 500 Internal Server Error on Apache
/var/www/html/.htaccess: RewriteCond: bad flag delimiters
Apache and Laravel report different 500s.
5 causes, each with a fixBack end
Composer says the gd extension is missing on a Laravel project
composer install or composer update stops on a package that requires ext-gd
Composer refuses to install a package that requires ext-gd when the PHP binary running Composer has no GD extension.
4 causes, each with a fixBack end
Why a Filament panel feels slow on a Laravel server
The panel is fast on a small demo and slow once there are many resources, pages and widgets
A slow Filament panel on a server is most often running without the production caches.
3 causes, each with a fix