Menu

Deploy a Website to cPanel Shared Hosting
πŸ–ΌοΈ

Deploy a Website to cPanel Shared Hosting

DEV CommunityΒ·Rafli ZockyΒ·6 months ago
#8w8ZXSWh
#webdev#php#cpanel#software#laravel
Reading 0:00
15s threshold

Even if you're using another framework or shared hosting provider, the process will be quite similar.

Steps

1. Export your local database (via phpMyAdmin or mysqldump )

2. Create two ZIP archives:

laravel.zip β†’ all project files except the public folder

public.zip β†’ contents of the public folder only

3. Create Database on cPanel

Login to cPanel β†’ Manage My Databases

Create a new database, user, and assign user privileges

4. Import Database

Open phpMyAdmin in cPanel

Select the created database

Import the exported SQL file

5. Set PHP Version

In cPanel, open Select PHP Version

Choose PHP 8.2 (or required version)

6. Upload Files

Open File Manager in cPanel

Upload and extract:

public.zip β†’ into /public_html/

laravel.zip β†’ outside /public_html/ (e.g., /home/username/laravel/ )

7. Configure index.php

Update paths in /public_html/index.php :

require __DIR__ . '/../laravel/vendor/autoload.php' ; require_once __DIR__ .…

Continue reading β€” create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.