Deploy laravel application in Cpanel
-
Setup 1 : – upload file to Cpanel the root directory – not the public_html.
-
Setup 2 : – Open the that folder and MOVE the CONTENTS of the public folder to your cpanel’s public_html .
-
Setup 3 : – Navigate to the public_html folder and locate the
index.php
file. Right click on it and select Code Editor from the menu.
and change this line
require __DIR__.'/../folderName/vendor/autoload.php';
$app = require_once __DIR__.'/../folderName/bootstrap/app.php';
NOTE : – folderName here is in root where you laravel application stay
that’s it now all your request will come inside public_html folder index.php
and this file will include require __DIR__.'/../folderName/vendor/autoload.php;
and run laravel application
Folder structure will look like
/laravel
/public_html/index.php
indside index.php
require __DIR__.'/../laravel/vendor/autoload.php';;
$app = require_once __DIR__.'/../laravel/bootstrap/app.php'; // here laravel is folder name