How can a host a Laravel 5.6
app to cpanel on a shared hosting.
Can someone give me an idea
require __DIR__.'/../vendor/autoload.php';
/*
|--------------------------------------------------------------------------
| Turn On The Lights
|--------------------------------------------------------------------------
|
| We need to illuminate PHP development, so let us turn on the lights.
| This bootstraps the framework and gets it ready for use, then it
| will load up this application so that we can run it and send
| the responses back to the browser and delight our users.
|
*/
$app = require_once __DIR__.'/../bootstrap/app.php';
/*
#########my index.php file
7
Answers
You have two methods available, one requiring ssh access. Under no circumstances do you put your entire Laravel directory into the
public_html
directory.SSH Access
If you have SSH access you’ll want to do the following;
cd ~
public_html
directory~/laravel
cd ~ && ln -s laravel/public public_html
No SSH Access
If you don’t have SSH access you’ll want to do the following;
~/laravel
(above the public_html)~/laravel/public
directory topublic_html
Your new
~/public_html/index.php
should look like the following;after googling around i found that you have to take content of public folder which has index.php file and put it in public_html. now we have to change the content of index.php file i.e just provide the right link of app.php and autoload.php which would be
require __DIR__.'/<project_folder_name>/vendor/autoload.php'
and$app = require_once __DIR__.'/<project_folder_name>/bootstrap/app.php';
also update your .env file and check it should work if it doesnt you have to clear cache and routes usingphp artisan cache:clear
andphp artisan route:clear
you can do this using ssh or define the function in web.php and then hitting the linkAn easy way if your shared hosting team is very supportive for you,
Upload your files to public_html folder, and then incase if you donot have ssh access to server, contact your hosting team and ask them to point your domain name to public_html/public folder as root folder.
And then ask them to execute following command via ssh
If you want to boost the peformance, please provide them the four commands listed in the following article.
https://www.techalyst.com/links/read/112/boosting-laravel-performance-in-production-server
Umm. Shared hosting does NOT support php 7, which larave 5.6 depends on. Have you guys found a workaround. I have been stuck for months with laravel 4.x on bluehost.
Laravel 5.6
requiresPHP 7
.First check your shared hosting support
PHP 7
in Cpanel (PHP Selector), if yes but you have other projects whichPHP 5
and you don’t want to change default php version, then use this in.htaccess
fileFor example: public_html/abc/.htaccess
Then
PHP 7
Work and you can work withLaravel 5.6
on shared hostingdon’t forget to change your php version to 7.2
The simplest way to host on shared hosting
Note: If you face any due to cache remove file config.php in directory bootstrap/cache.