In most cases a freshly uploaded Laravel that shows a 500 error has one of four causes: the application key is missing, the storage and bootstrap/cache folders are not writable, the vendor folder is missing, or the PHP version is one the project does not accept. The exact message is in the log file, and it tells you which.
First, read the message
Laravel writes its errors to storage/logs/laravel.log. Open the file in the File Manager and go to the end: the last lines say what failed. If that file does not even exist, the problem comes earlier (permissions or PHP), and PHP’s own error_log, in the public folder, is the one to read: where the PHP error log is.
| The message says |
Cause |
What to do |
| No application encryption key has been specified |
The APP_KEY line in .env is empty, or the file does not exist. |
In the Terminal, from the project root: php artisan key:generate. It writes the key into .env. |
| Failed opening required 'vendor/autoload.php' |
The vendor folder was not uploaded or was never created. |
Run composer install or upload the folder. Composer on shared hosting. |
| Your Composer dependencies require a PHP version… |
The folder’s PHP is older than the project asks for. |
Pick another version in Select PHP Version: changing your PHP version without breaking the site. |
| Permission denied / could not be opened (storage/logs) |
Laravel cannot write to storage or bootstrap/cache. |
Make those two folders and their subfolders writable, in the File Manager (Change Permissions). |
| Class not found, after changing the code |
The configuration cache or the autoload is out of date. |
Run php artisan config:clear and composer dump-autoload. |
The order that saves time
| 2 |
Check the site root. The domain must point at the project’s public folder. Pointing at the root gives 403, 404 or a file listing.
|
|
| 3 |
Check .env. The file must exist (the template is called .env.example), with the database and address details, and the APP_KEY line filled in.
|
|
| 4 |
Clear the caches whenever you change .env: php artisan config:clear. If the project uses the configuration cache, Laravel ignores changes to .env until you clear it.
|
|
| 5 |
Reload the page and read laravel.log again. Each fix reveals the next, and the message changes. Go one at a time.
|
|
|
Do not fix a 500 by switching debug mode on in production. With APP_DEBUG=true, any visitor sees your code, your paths and sometimes database details. Turn it on only for as long as it takes to read the error, or better, read laravel.log and leave it off. After fixing, set APP_DEBUG=false.
|
|
Changed .env and nothing changed? It is almost always the configuration cache. And if you changed the database password, php artisan config:clear is the first command to run. For the rest of the road for Laravel on hosting, see getting a Laravel application running.
|
|
Read laravel.log and the message means nothing to you? Send us the domain and the last message in the file, without passwords.
Open a support ticket
|
RECOMMENDED PRODUCT Web hosting with cPanel Domain and SSL included, daily backups and the panel you already know. from £5.28/mo (3-year plan, with coupon) See plans |