skip to Main Content

I have deployed laravel project to shared hosting but it returns HTTP error 500.

I will shortly describe to you all steps I have done and if there is mistake pls help 🙂

So here we go…
-I have run composer install –optimize-autoloader –no-dev
-I have run PHP artisan config:cache then PHP artisan config:clear
-After that I have run npm run prod and exported refreshed database with seeded admin acc

-In cPanel I have created database (from .env) and a username and his password (and added all that to .env)
Also, I have connected that admin acc and database successfully 🙂
-Then I have imported refreshed database in DB that I have just made on cPanel

-All files from the public folder I have uploaded to public_html
-And all folders and files (except public) I have created a new folder in the root and uploaded the rest of the project there
-After that, I went back to public_html/index.php and changed the path of 2 lines:
1. require DIR
2. $app = require_once

So instead of

require __DIR__.'/../vendor/autoload.php

I have put

require __DIR__.'/../folder_name_where_rest_of_app_is/vendor/autoload.php

And, same is done for $app line …

Saved latest changes and then I have tried to refresh the site and it just throws HTTP Error 500

PS: Also I have added these lines

APP_ENV=production


APP_DEBUG=false

And on APP_URL is the copied URL from the browser…

If anywhere you can see any mistakes please tell me 🙂

2

Answers


  1. try this

    php artisan optimize:clear
    composer dump-autoload
    
    Login or Signup to reply.
  2. There are many possibilities.

    To debug, limit access with something like HTTP basic auth or IP access control and turn on APP_DEBUG.

    Check the log files in storage/logs/ and the web server logs.

    Make sure the environment has an encryption key set. If not run:

    php artisan key:generate

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search