Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

MDRaselRana's avatar

Deploy Laravel 5 application on hostgator shared hosting.

I have uploaded my Laravel 5.1 application on http://billing.jbrsoft.com/ this url and i have configure .env file and public/index.php file. Till now it's a blank page. Help me out.

0 likes
8 replies
Snapey's avatar

OK, so take it straight down again and change your database password.

I can see that it starts with T}3g...

You need to upload laravel so that it is in the directory above the published webspace or in a separate directory that cannot be accessed by visitors

Snapey's avatar

your hosting provider will advise to publish your site in a folder like www or wwwroot. You should only put the contents of your public folder in there. Their rest of the framework should live above the public space either directly in that folder, or if that seems to messy put it in a new folder.

If you do use a new folder then you will need to make small changes to your index.php

1 like
bashy's avatar

For custom public folders, it's best to use a symlink. Depends what your host can do though.

sameeranand's avatar

When you created the shared hosting account with Hostgator, the document root for your primary domain was set to the public_html folder. In a Laravel application, the document root must be set to the public directory and not public_html, because Laravel does not have a directory called public_html.

So you have two options.

Option 1 In your Laravel application, rename the public folder to public_html. If you do this, you need to make sure to override the public path in your Laravel application. In other words, you must tell Laravel that the document root is public_html.

You can do this by putting the following code in your index.php file in the public directory.

$app->bind('path.public', function() {
    return __DIR__;
}

Option 2 Rename the public_html folder on your server to public. If you do this, you'll need to change or update the document root for the domain on the server. Generally on shared hosting servers, you can only change the document root for your addon domains and subdomains. If you go with this option, and the domain you are using is the primary domain on the account (unless it's a subdomain of your primary domain), you may have to contact Hostgator and see if they'll update the document root for you.

jlrdw's avatar

A side note, you don't have to use a .env file.

Please or to participate in this conversation.