Quick answer: A Laravel 500 error after deploy almost always leaves a clue in storage/logs/laravel.log or the server error log. Read the log first, then check the usual causes in order: a missing APP_KEY, a document root that does not point at the public folder, unwritable storage and bootstrap/cache directories, a stale config cache, or database settings that still point at your laptop.
You ship a Laravel app that ran fine locally, reload the live URL, and get a blank page or a generic “500 Internal Server Error”. That message only tells you the server could not complete the request. It does not tell you why. This guide is a practical way to find the cause without turning debug mode on for the whole internet. If you have not set the live environment file yet, start with our checklist for the Laravel .env file, then come back here with the log open.
What a 500 error actually means
HTTP 500 is a server-side failure. The request reached the server, PHP started, and something in the application or the server configuration threw an error that was not turned into a friendlier response.
On a well-configured live site, Laravel will not show the stack trace in the browser. That is deliberate. APP_DEBUG should be false in production so visitors never see file paths, queries or environment values. The trade-off is that you have to look at logs instead of the page itself. Do not “fix” a live 500 by setting APP_DEBUG=true on a public URL. Read the log, fix the cause, and leave debug off.
Look at the log before you change anything
Laravel writes exceptions to storage/logs/laravel.log by default, one file that grows as errors arrive. The useful part is usually the most recent block: a timestamp, the exception class, a message, and a stack trace. Laravel’s logging documentation describes the default channel and how to change it (checked November 2026).
If that file is missing, empty, or has not been updated at the time of the error, look at the web server’s own error log as well. A failure that happens before Laravel boots — a wrong document root, a PHP fatal error during autoload, or a permissions problem that prevents Laravel from writing its log — will show up there instead.
Copy the exception message out exactly. “Class not found”, “No application encryption key”, “SQLSTATE”, “Permission denied” and “MissingAppKeyException” each point to a different fix. Guessing from the browser page wastes time.
The causes we see most often after a deploy
1. Missing or invalid APP_KEY
Laravel will not run properly without an application key. The APP_KEY value in the live .env file must be present, and it must be a key generated for that environment, not an empty string and not a placeholder from .env.example.
Generate it as part of your deploy process with php artisan key:generate on the live app (or paste a key you generated in a safe environment and stored privately). If you change a key on a site that already has encrypted data or existing sessions, those sessions end and encrypted values will not decrypt with the new key. For a first deploy of a new app, a fresh key is the right move.
2. Document root is not the public folder
Laravel’s front controller is public/index.php. The domain’s document root should point at the public directory, not at the project root. If the document root is the project root, the server may fail to route requests correctly, or worse, it may expose files that should stay private, including .env.
Our guide on how to host a Laravel website on shared hosting walks through this layout. Confirm it before you hunt through application code. A 500 that appears on every URL, including a plain slash, is often a document-root or bootstrap problem, not a bug in a single route.
3. storage and bootstrap/cache are not writable
Laravel needs to write compiled views, cache files and logs. The storage directory and bootstrap/cache must be writable by the user that runs PHP. Laravel’s deployment documentation calls this out as a requirement (checked November 2026).
If PHP cannot write the log file, you get a 500 and no Laravel log to read, which is why the server error log matters as a backup. Fix ownership and permissions on those two directories, then reload. Do not make the rest of the project world-writable to “just get it working”.
4. A stale or incomplete config cache
On a live site it is normal to run php artisan config:cache so Laravel is not reading the .env file on every request. Two things go wrong here after a deploy.
First, an old cache file from a previous server or from your laptop can ship with the deploy and freeze the wrong database host, URL or mail settings. Delete it with php artisan config:clear, confirm the live .env, then cache again on the live app.
Second, once the config is cached, env() calls outside the config folder return null. If your application code reads env('APP_URL') or a secret directly, those values vanish after you cache config, and features start failing in ways that look random. Move those reads into config files and use config() instead. The earlier Laravel .env file post covers this trap in more detail.
How you run Artisan commands depends on your hosting. Some plans give you a terminal; others expect you to run them during deployment from your own machine or a deploy script. Check what your plan actually offers rather than assuming a particular tool is available on the server.
5. Database settings still point at local
A copied local .env often leaves DB_HOST=127.0.0.1, a local database name and a local password. The site then throws a 500 as soon as a page hits the database, and the log shows an SQLSTATE connection error.
Set the live host, port, database name, username and password, and confirm the database exists before you retry. If you are putting a Laravel app on shared hosting, our note on PHP hosting with MySQL explains the PHP and database side the app is sitting on.
6. The vendor directory is missing
Laravel depends on the packages in vendor. If that directory was not part of the deploy — because it is in .gitignore and the install step did not run where the files were built — PHP dies when it cannot autoload classes. The error is often “Failed to open required” for vendor/autoload.php, or a class-not-found exception.
Install dependencies as part of the build you upload, on a machine that has the tools to do it, and deploy the result. Do not assume every hosting plan includes those tools on the server itself.
7. The PHP version is too old
Current Laravel versions require a recent PHP release. If the live server is on an older PHP than the one you used to build the app, you can get a 500 during bootstrap, sometimes with a parse error in the server log. Check the PHP version your app was built for, then check the version the site is actually running. Shaz3e’s guide to Laravel hosting requirements is a useful companion for the baseline.
A short order of checks
| Check | What “wrong” looks like | What to do |
|---|---|---|
| Laravel log | A fresh exception at the time of the request | Read the message and stack before changing files |
| Server error log | PHP fatal error, or nothing in the Laravel log | Fix bootstrap, autoload or permissions first |
| APP_KEY | “No application encryption key has been specified” | Generate a live key and keep it private |
| Document root | Every URL 500s, or .env is reachable in the browser |
Point the domain at the public folder |
| Writable dirs | Permission denied writing logs, views or cache | Make storage and bootstrap/cache writable |
| Config cache | Settings you just changed have no effect, or env() is null |
Clear, fix .env and config files, cache again |
| Database | SQLSTATE connection or access denied | Set live credentials and confirm the database exists |
| vendor/ | Cannot find autoload.php or a package class |
Deploy a build that includes installed dependencies |
Once the site loads, keep debug off
When the page returns 200, resist the urge to leave debug on “just for a few days”. A stack trace on a live form or an admin URL is a gift to anyone probing the site. Keep APP_DEBUG=false, keep APP_ENV=production, and use the log (or a log service you already trust) when something fails again.
Laravel’s deployment documentation also recommends other production steps, such as caching routes and views, once the app is stable. Do those after the 500 is gone, not as a first move that might cache a broken state.
Moving the app as well as debugging it?
If the 500 appeared because you just copied the project to a new host, treat the environment file and the document root as part of the move, not as afterthoughts. Test a fresh request, a login and a page that hits the database before you point the domain at the new server. ResellerBytes offers free website migration on its shared hosting plans if you would rather have the move done for you. You can compare the Starter, Business and Pro plans on the ResellerBytes hosting page.
Frequently asked questions
Why do I get a Laravel 500 error after deploy when it worked on my laptop?
The live server has a different .env, a different document root, different file permissions and often a different PHP version. The code can be identical and still fail on any one of those. The log tells you which one.
Should I set APP_DEBUG to true to see the error?
Not on a public live URL. The debug page can expose paths, queries and environment data. Read storage/logs/laravel.log or the server error log instead. If you need a debug page, use a private staging copy that is not on the public domain.
The Laravel log file is empty. Now what?
The failure probably happened before Laravel could write a log, or the storage directory is not writable. Check the web server error log, confirm document root and permissions, and confirm vendor/autoload.php is present.
Does clearing the config cache fix every 500?
No. It fixes stale or incomplete cached configuration. It will not fix a missing key, a wrong document root, a missing vendor directory or a database that refuses the connection. Use it when the log or the symptoms point at configuration.
Can a plugin or package cause this?
Yes. A package that runs a service provider at boot can throw during every request. The stack trace in the log usually names the package class. Disable that package in a local or staging copy, or roll back the deploy, rather than debugging only on the live site.
Share this content:
