How to Fix the Laravel 500 Internal Server Error

The 500 Internal Server Error (often also appearing as a blank white screen / white screen of death) is the most panic-inducing error, because Laravel doesn't tell you what caused...

How to Fix the Laravel 500 Internal Server Error
Advertisement

The 500 Internal Server Error (often also appearing as a blank white screen / white screen of death) is the most panic-inducing error, because Laravel doesn't tell you what caused it on the screen. Yet the cause is usually one of a few common things. This article guides you to find and fix it systematically.

Step 0: Check the Error Log First

Before guessing, open the Laravel log — this is where the actual cause is recorded:

storage/logs/laravel.log

Look at the very bottom line (the latest error). For the time being, you can also enable error display by setting your .env:

Advertisement
APP_DEBUG=true

Then reload the page to see the detailed message. Set it back to false once you're done so errors don't leak to the public.

1. Permissions on the storage & bootstrap/cache Folders

The most common cause on the server. Laravel needs to write to these two folders. Fix the permissions:

chmod -R 775 storage bootstrap/cache
chown -R www-data:www-data storage bootstrap/cache

Replace www-data with your web server user (e.g., apache, or your cPanel user).

2. APP_KEY Not Yet Generated

If APP_KEY in .env is empty, Laravel fails to encrypt and immediately throws a 500 error. Generate it:

Advertisement
php artisan key:generate

3. The .env File Is Wrong or Missing

After uploading to the server, the .env file is often forgotten. Make sure the .env file exists and contains the correct database configuration. Copy it from .env.example if needed, then fill in the credentials.

4. Config Cached from an Old Environment

If you move a project between servers but the old cache comes along, the config may point to the wrong path/credentials. Clear it:

php artisan config:clear
php artisan cache:clear
php artisan view:clear
php artisan route:clear

5. Composer Dependencies Not Installed

If the vendor folder is missing or incomplete, the application cannot run. Install the dependencies:

composer install --optimize-autoloader --no-dev

6. Incompatible PHP Version

Modern Laravel requires a specific PHP version (e.g., Laravel 10 requires PHP 8.1+). If the server uses an older version, it will error. In cPanel, change it via the Select PHP Version menu. Check the version via the CLI:

php -v

Recommended Diagnostic Flow

  1. Enable APP_DEBUG=true or read storage/logs/laravel.log.
  2. Read the specific error message — it usually already points to a file & line.
  3. Check the permissions on storage & bootstrap/cache.
  4. Make sure .env, APP_KEY, and vendor are in order.
  5. Clear the config cache, then try again.
  6. Turn APP_DEBUG back off.

Conclusion

A 500 error in Laravel is rarely mysterious if you start by reading the log. Most cases are caused by folder permissions, an empty APP_KEY, or a wrong .env. Follow the diagnostic flow above in order and the error is usually found within a few minutes. For a specific case after login (error 419), see our guide on fixing the 419 Page Expired error in Laravel.

Advertisement
error 500 laravel internal server error laravel laravel white screen laravel 500 error layar putih laravel
Share this article
Back to Blog
🚀 Partner Recommendation

Need Premium Source Code & Business Apps?

Access Laravel applications, POS systems, School Management, Clinic Software, ERP solutions, and ready-to-use premium source code at GudangCode.

GudangCode
  • ✔ Premium Source Code
  • ✔ Ready-to-Use Systems
  • ✔ Lifetime Updates
  • ✔ Lifetime Membership
  • ✔ Daily App Updates
Join Membership →
Advertisement
Advertisement