How to deploy Laravel project on cPanel
Deploy a Laravel application on a shared hosting Cpanel, for example. This article will teach you how to install a Laravel project on shared hosting Cpanel from the ground up. Shared hosting is a form of Web hosting service that allows numerous websites to share the same physical Web server and its resources. This article on how to deploy a laravel app on shared hosting will walk you through the process of deploying a laravel project on shared hosting or Cpanel.
1- Select all the files have inside the Laravel project folder, Then compress them into a ZIP
2- Login to cPanel, Go to File manager
3- Go inside to Public_html
4- Press Upload from the top list
5- Click Select file
6- Select the file compressed ZIP of the Laravel project
7- Extract the file uploaded
8- Click Extract files
9- Click Close
10- After extracting you need to remove the ZIP folder uploaded due to visitors not downloading your project folder
11- Press Confirm
12- Click File from the left side of the top
13- Write from the name input, Copy the text below & Then click create a new file
14- Click Settings from the right side top
15- Tick on the Show hidden Files, Then press save
16- Right-click on the .htaccess file and press edit
17- Copy the codes below and paste them to your .htaccess
RewriteRule ^(.*)$ public/$1 [L]
18- Press Save changes
19- After checking your website see shows this error, Because Laravel 9 requires PHP version 8
20- Go to cPanel first page and find the " Select PHP Version "
21- Change the current version of PHP to 8.0
22- Set version 8.0 as current
23- Check your website now should work!
IF YOUR PROJECT HAS A DATABASE? STILL FOLLOW ME!
24- Go to Mysql database wizard
25- Write the name of the database
26- when you fill all inputs, Press create user
27-Tick All privileges, Then press make changes after that click the next step
28- Go back to file manager / Public_html / find the .env file and click right on it then press edit
29- Enter the database information and you have done.
Congratulations! Your Laravel project has been successfully deployed to Cpanel. Try laravel now with REGXA's Laravel hosting.