Laravel and PHP errors
Laravel 500 error after deploy: causes and how to fix it
The short answer
Works on your machine, breaks on the server? That is the classic deploy gap. The code is rarely the culprit; the environment is. The log tells which part, and you should not turn on debug mode to find out.
- Backup before every change
- Fixed price before we start
- Remote, anywhere in the world
- Free diagnosis
Laravel hides details from visitors on purpose, so the page itself tells you almost nothing. The answer sits in storage/logs/laravel.log or the PHP error log, and it is usually one of a short list: .env, permissions, dependencies, migrations, PHP version or cache. The same logic applies to custom PHP and other frameworks. Fixing it safely means reading the log first and changing only what it points at.
Sound familiar?
How a Laravel 500 error shows up after a deploy
- A blank page, a plain “500 Server Error” or “Whoops, looks like something went wrong”
- The site works locally or on staging, but not on the live server
- Errors such as “No application encryption key has been specified” or “Class not found”
- You see a directory listing, a 403 or the raw contents of index.php instead of the site
- Only pages that use the database or file uploads fail
Causes
What causes a Laravel 500 error after deploy?
Missing .env or APP_KEY
Without a .env file or a valid APP_KEY, Laravel cannot decrypt sessions and cookies or connect to the database, and every request fails.
Storage and cache not writable
The web server user cannot write to storage or bootstrap/cache, so logs, sessions, compiled views and cache files cannot be created.
Dependencies not installed
The vendor folder is missing or out of date because composer install did not run, or it was installed for a different PHP version.
Migrations not run
The new code expects tables or columns that do not exist yet, so queries fail as soon as those pages are opened.
PHP version or extension mismatch
The server runs an older or newer PHP version than the project needs, or lacks an extension such as mbstring, intl, gd or pdo_mysql.
Stale cache or wrong document root
A cached config or route file still holds old values, or the web server points to the project root instead of the public folder.
Try it yourself
Checking a Laravel 500 error yourself
If you or your developer have SSH access, these checks often reveal the cause.
- 1 Read the last lines of storage/logs/laravel.log and the PHP or web server error log. The first error message usually names the problem.
- 2 Check that a .env file exists on the server, matches production values and contains an APP_KEY. Generate a key only for a new install, because changing it invalidates existing encrypted data and sessions.
- 3 Run composer install --no-dev --optimize-autoloader with the same PHP version the web server uses.
- 4 Run php artisan migrate --force after checking that you have a fresh database backup.
- 5 Clear and rebuild caches with php artisan optimize:clear, then php artisan config:cache and php artisan route:cache.
- 6 Make sure storage and bootstrap/cache are writable by the web server user, without making the whole project world-writable.
- 7 Check that the document root points to the public folder, and that APP_DEBUG is false and APP_ENV is production on the live site.
Our approach
How we fix a Laravel 500 error
-
1
You describe the deploy
Tell us what was deployed and what you see now. We let you know which access we need.
-
2
Backup before any change
We copy the current code, .env and database first, so the server can always be returned to its present state.
-
3
We read the logs and quote
We trace the error in the Laravel and server logs, compare the environment with what the project needs and send a fixed price.
-
4
We fix, test and report
After your approval we fix the environment or code, test the main routes and send a short report, with tips for safer future deploys.
What we need
What we need from you
- SSH or SFTP access to the server, or a hosting control panel
- Access to the repository or deployment tool, if you use one
- Database access, or a recent database backup
- What was deployed, when, and whether it works on another environment
We use a separate SSH key per client and the least access that does the job. You can remove our key the moment we are done.
What we cannot fix
We cannot fix outages at your host, servers or repositories we cannot access, or limits on shared hosting that block a required PHP version or extension. Large application bugs that need new features or a redesign are outside a fixed-price repair. If that applies, we tell you quickly and explain your options.
Price
Price and what happens next
-
1
Free diagnosis
We find the cause and tell you what is wrong.
-
2
Fixed price
You get a price and a time estimate. Nothing starts without your yes.
-
3
Fixed and reported
We repair it, test it and send a short report.
From €295 excl. VAT
Fixed price, agreed before we start
Is it urgent? Say so in the form or in the chat. We start as soon as we can and give you a realistic time estimate with the quote. If priority work costs extra, you see that in the quote before you agree.
Get it fixedQuestions?
Laravel 500 error: frequently asked questions
Also see
Related problems
HTTP error 500
A 500 Internal Server Error is a generic HTTP status code. It means the server hit an unexpected problem while building your page and cannot...
Read more →Broken after an update
A website that breaks right after an update usually has a version mismatch: a plugin, theme or piece of custom code that does not work with...
Read more →Database connection error
“Error establishing a database connection” means your site’s code runs but cannot reach or log in to the database that holds your content. M...
Read more →Last updated:
Request
Tell us what is wrong
Answer a few short questions. You get a fixed price before we do anything.
Thank you for your request!
We will contact you shortly
An error occurred!
Please try again.