Following this SO thread has worked for me on hostgator to install laravel in a subfolder on shared hosting.
(If it's your primary domain you can adjust the number of ../. Check your php error log if it's having problems finding files and then correct the path to resolve those.)
Basically upload your laravel project folder in to something like /laravel/
This will be in the directory above your /public_html/ folder.
Then modify these two files outlined below based on the details in the StackOverflow link above.
Finally, we need to edit 2 files: Laravel's /bootstrap/paths.php and /public/index.php.
In the paths.php file, replace:
'app' => DIR.'/../app', with:
'app' => DIR.'/../../laravel/app', In the paths.php file, replace:
'public' => DIR.'/../public', with:
'public' => DIR, In the paths.php file, replace:
'base' => DIR.'/..', with:
'base' => DIR.'/../../laravel', In paths.php, replace:
'storage' => DIR.'/../app/storage', with:
'storage' => DIR.'/../../laravel/app/storage', In index.php, replace:
require DIR.'/../bootstrap/autoload.php'; with:
require DIR.'/../../laravel/bootstrap/autoload.php'; In index.php, replace:
$app = require_once DIR.'/../bootstrap/start.php'; with:
$app = require_once DIR.'/../../laravel/bootstrap/start.php';
(Don't forget to update your database information)
Thanks for the long and detail reply. Hhmm pretty hassle....but will try it.
Appreciate it.
Hc.
I wouldn't recommend shared hosting for Laravel app. Shared hosting may be cheap, but it has security and performance issues. Since resources are shared with multiple users, this may affect the performance often. If a website on a shared server is experiencing sudden spike in traffic, this will affect the performance of other websites in the same server. Instead, I would recommend to use hosting, like DigitalOcean, instead. They are cheap and don't have performance and security issues like shared hosting. If you believe that hosting Laravel on DigitalOcean may be difficult, then try doing it using managed hosting platform, like Cloudways. Using their platform you can install Laravel on DigitalOcean in just a single click. https://www.cloudways.com/en/laravel-hosting.php
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community