Home > Back-end >  HTTP 500 response and white screen while trying to deploy laravel 8 app to hostinger shared hosting
HTTP 500 response and white screen while trying to deploy laravel 8 app to hostinger shared hosting

Time:10-10

The title sums up my issue. I'm deploying to shared hosting by uploading my files (except mylaravelproject/public/ to the root directory, and the contents of mylaravelproject/public/ to public_html/.

I've already tried the following:

  • Configuring index.php to point to the correct folder in root
  • Running composer install and npm install in the relevant directory
  • php artisan key:generate
  • php artisan cache:clear and php artisan config:clear
  • composer dump-autoload
  • Configuring .env and changing the relevant fields: APP_URL and database related ones

I'm still met with a white screen and an HTTP 500 error. What should I do?

CodePudding user response:

Whoops! I was able to solve it on my own somehow. Thanks to everyone who replied still.

For anyone having similar issues:

Start by adding the following to the top of index.php:

ini_set('display_errors', '1');
ini_set('display_startup_errors', '1');
error_reporting(E_ALL);

Turns out hpanel / hostinger's directory structure is weird, and public_html/ from the file manager is actually a shortcut to a folder not directly under root. Here's what it actually looks like:

/
| - domains
    | - yourdomainname.com
        | - public_html
            | - index.php

So unlike most guides out there, relevant directories under index.php need to be changed to something like __DIR__.'/../../../laravelinrootname/storage/framework/maintenance.php'

CodePudding user response:

Enable debugger to know the issue

inside Config/App.php change

'debug' => env('APP_DEBUG', false)

to

'debug' => env('APP_DEBUG', true)

& in .env make APP_DEBUG= true

APP_ENV=local
APP_DEBUG=true
  • Related