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 thepublicfolder -
public.zip→ contents of thepublicfolder 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__ . '/../laravel/bootstrap/app.php';
8. Configure .env
Edit .env in the Laravel folder:
APP_URL=https://yourdomain.com
DB_CONNECTION=mysql
DB_HOST=localhost
DB_PORT=3306
DB_DATABASE=your_cpanel_db_name
DB_USERNAME=your_cpanel_db_user
DB_PASSWORD=your_cpanel_db_password
9. Handle Storage
Without SSH, create a manual storage link by copying /laravel/storage/app/public → /public_html/storage, or run php artisan storage:link locally before zipping.
Alternatively, create symlink.php at public_html:
<?php
$target = $_SERVER['DOCUMENT_ROOT']."/../laravel/storage";
$link = $_SERVER['DOCUMENT_ROOT']."/storage";
if(symlink($target, $link)){
echo "OK.";
} else {
echo "Failed.";
}
?>
FAQ
Do I need to re-upload everything after changes?
Not always. You can upload only modified files, but many devs re-upload the whole project to avoid missing updates.
Other ways to upload besides cPanel File Manager?
- FTP/SFTP → FileZilla, Cyberduck — easier for incremental updates
- Git → Some shared hostings support Git via cPanel Git™ Version Control
Need help building your app?
I'm available for freelance web & Android development — raflizocky.netlify.app
☕ Support my writing: paypal.me/raflizocky · saweria.co/raflizocky
Top comments (0)