India English
Kenya English
United Kingdom English
South Africa English
Nigeria English
United States English
United States Español
Indonesia English
Bangladesh English
Egypt العربية
Tanzania English
Ethiopia English
Uganda English
Congo - Kinshasa English
Ghana English
Côte d’Ivoire English
Zambia English
Cameroon English
Rwanda English
Germany Deutsch
France Français
Spain Català
Spain Español
Italy Italiano
Russia Русский
Japan English
Brazil Português
Brazil Português
Mexico Español
Philippines English
Pakistan English
Turkey Türkçe
Vietnam English
Thailand English
South Korea English
Australia English
China 中文
Somalia English
Canada English
Canada Français
Netherlands Nederlands

How to Deploy Laravel on Shared Hosting Easily

We are Hiring!

We are looking for an experienced SEO writer and copywriter to join us at Cloudoon

Have you ever tried to put your Laravel app online and faced errors, slow loading, or confusing steps? 

Many developers in Kenya know this struggle, especially when working on small projects or side businesses with limited time and budget.

You want your app live fast. You also want a simple setup that does not need advanced server skills. 

Shared hosting helps you do this. It is cheap, easy to use, and great for beginners.

This guide shows you how to deploy Laravel on shared hosting using clear steps and simple terms. 

You will learn how to upload your files, set up your project, fix common issues, and make your site run smoothly on cPanel hosting like Truehost.

Here is what you will learn:

  • A short look at Laravel and shared hosting
  • Why this setup works well for your needs
  • Step-by-step deployment using cPanel
  • Important things you must know
  • Final steps to keep your app ready and safe

Let us begin and make your project live.

What is Laravel?

deploy laravel on shared hosting

Laravel is a free tool that helps you build websites and apps using PHP. 

It handles many common tasks for you, such as connecting to a database or managing user logins. This saves you a lot of time.

Laravel follows a method called MVC.

  • Model handles data
  • View handles what users see
  • Controller handles the logic

This helps keep your code clean and easy to improve.

Laravel also gives you tools like:

  • Eloquent for simple database actions
  • Blade for easy page design

Taylor Otwell, the creator, says it removes the hard parts of development. 

Many Kenyan developers like Laravel because it lets them build apps such as online shops, school systems, or blogs very fast.

Important note: Laravel needs PHP 8.2 or higher. Make sure your hosting plan supports this before you start.

What is Shared Hosting?

Shared hosting means you share one server with many other websites. It’s like sharing a computer lab. 

Everyone uses the same machines, but you each have your own account.

With shared hosting, you get tools like cPanel to manage files, emails, and databases. 

The hosting company handles security, server maintenance, and updates.

It is also affordable. In Kenya, many plans cost under KES 500 per month. 

Truehost offers shared hosting that works well with Laravel and supports M-PESA payments.

Hosting Comparison

Hosting TypeCost (KES/mo)Best For
Shared300–800Small sites
VPS1,500+Growing apps
Dedicated5,000+Very high traffic

Shared hosting has limits because you share resources. Heavy traffic may slow your site. But for most small Laravel apps, it works very well.

Why Deploy Laravel on Shared Hosting?

Many people think Laravel needs a powerful server. This is not true. Shared hosting is enough for many small apps and new projects.

Benefits:

  1. Low Cost
    You do not need to spend on a VPS. A simple KES 399 plan from Truehost is enough for many apps.
  2. Easy to Use
    You can upload and manage your site using simple cPanel tools. You do not need command-line experience.
  3. Good for Small Traffic
    If your site gets around 1,000 to 5,000 visitors a month, shared hosting works well.

Shared hosting has limits such as no full SSH access. But you can avoid problems by preparing your project locally.

Overall, shared hosting gives you speed, savings, and ease of use.

How to Deploy a Laravel Application to Shared Hosting?

Now let us upload your Laravel app to shared hosting using cPanel. These steps take about 20 to 30 minutes if your project is ready.

deploy laravel on shared hosting

This guide assumes you are using Laravel 12 and PHP 8.2 or higher.

Before starting, test your app locally using:

php artisan serve

If everything works, move to the steps below.

Step 1: Prepare and Compress Your Laravel Project Folder

Open your project on your computer. Make sure it is ready for production.

Run these commands:

php artisan config:cache

php artisan route:cache

php artisan view:cache

These make your app faster.

If you do not have an app key, create one:

php artisan key:generate

Remove folders you do not need on the server such as:

  • node_modules
  • .git
  • .env

Now create a ZIP file of your project. You can use this command:

zip -r my-laravel-app.zip . -x “node_modules/*” “.git/*” “.env”

A ZIP file uploads faster and keeps everything organized.

Step 2: Upload the Compressed File to cPanel

Log in to your cPanel dashboard.
Go to:

File Manager > public_html

Click Upload and choose your ZIP file.

If your ZIP is large, you can use FTP software like FileZilla to upload it.

After upload, your file should appear inside public_html with no errors.

Step 3: Extract the Laravel Project Folder

Right-click your ZIP file and choose Extract.

For better security, extract your project outside public_html. Example folder:

/home/yourusername/laravel-app

Inside this folder, you should see:

  • app
  • public
  • storage
  • vendor
  • bootstrap

Now you must link the public folder to public_html. This protects your core files.

If your hosting allows symlinks:

  • Go to public_html
  • Right-click
  • Select Create Symlink
  • Point it to /laravel-app/public

If your host does not support symlinks, copy the contents of the public folder into public_html manually.

Set permissions:

  • Folders: 755
  • Files: 644

This helps avoid access errors.

Step 4: Configure the index.php File and Environment

Head to public_html/index.php (or your symlinked public).

For Laravel 10+, update paths. Edit to:

<?php

use Illuminate\Contracts\Http\Kernel;

use Illuminate\Http\Request;

define(‘LARAVEL_START’, microtime(true));

if (file_exists($maintenance = __DIR__.’/../laravel-app/storage/framework/maintenance.php’)) {

    require $maintenance;

}

require __DIR__.’/../laravel-app/vendor/autoload.php’;

$app = require_once __DIR__.’/../laravel-app/bootstrap/app.php’;

$kernel = $app->make(Kernel::class);

$response = $kernel->handle(

    $request = Request::capture()

)->send();

$kernel->terminate($request, $response);

Adjust ../laravel-app to match your folder.

Now, .env: Upload a copy (rename .env.example). Edit via File Manager.

Set DB details, APP_KEY (from local), APP_ENV=production, APP_DEBUG=false.

No SSH? Skip php artisan migrate here; do it via DB tool next.

Test: Visit your site. See Laravel welcome? Paths work. Errors? Check logs in storage/logs.

This update is crucial for smooth Laravel on shared hosting deploys. Truehost’s PHP tools help here see our hosting plans.

Step 5: Set Up the Database

In cPanel, open MySQL Databases.

  1. Create a new database
  2. Create a new user with a strong password
  3. Add the user to the database with full permissions

Export your database from phpMyAdmin on your computer.

Then in cPanel phpMyAdmin:

  • Choose your new database
  • Click Import
  • Upload your SQL file

Update your .env:

DB_CONNECTION=mysql

DB_HOST=localhost

DB_PORT=3306

DB_DATABASE=yourdb_laravel

DB_USERNAME=yourdb_user

DB_PASSWORD=yourstrongpass

If you have SSH access, run:

php artisan migrate

If not, migrate locally and import the SQL file.

Your app should now connect to the database.

Step 6: Create a Symlink for the Storage Folder

Storage keeps user files and cached data.

If your host allows symlinks:

Link:

/laravel-app/storage/app/public

to:

/public_html/storage

If not allowed, add this to .htaccess:

RewriteRule ^storage/(.*)$ ../laravel-app/storage/app/public/$1 [L]

Make sure storage folder permissions are 777.
This helps avoid upload errors.

Key Factors to Note When Deploying on Shared Hosting

deploy laravel on shared hosting

Here are important things to remember:

1) PHP Version

Laravel 12 needs PHP 8.2 or higher.
You can change this in MultiPHP Manager.

2) Performance

Enable OPcache in cPanel for faster pages.

3) Security

Block .env file access:

<Files .env>

Deny from all

</Files>

Common Issues

ProblemCauseFix
500 ErrorWrong permissionsUse 755 and 644
Missing routesNo .htaccessAdd rewrite rules
Slow siteCache issuesClear cache
DB errorsWrong .envCheck details

If your hosting plan does not support Composer, install all dependencies locally and upload the vendor folder.

If your traffic grows above 5,000 visits each month, consider upgrading to a VPS.

Conclusion

You have learned how to deploy Laravel on shared hosting in a simple and clear way. 

You uploaded your files, set up your database, adjusted your paths, and made your app live.

Your site is now ready for users.

Next steps:

  • Monitor your site
  • Update your app often
  • Make backups
  • Improve security

If you need help, Truehost Kenya offers full support and hosting plans that work well with Laravel.

FAQs

Can I deploy Laravel 12 on shared hosting?
Yes. You only need PHP 8.2 or higher and MySQL 5.7 or higher.

How much does hosting cost in Kenya?
Most shared hosting plans cost 300 to 800 shillings per month.

Why do I get a 500 error after upload?
Check your permissions and .htaccess file.

What if I do not have SSH access?
Run migrations locally and import the SQL file.

Symlink not working?
Copy the public folder files into public_html manually.

Is shared hosting good for an online shop?
Yes. It works well for small shops. Make sure you use SSL.

SSL COUPON Offer

Read More Posts

How to Host a Static Website on GitHub Pages

How to Host a Static Website on GitHub Pages

You’re building your portfolio in Nairobi or starting a side-hustle blog, but hosting feels tricky.  Some cheap options…

Free Web Hosting and Domain Name with cPanel: Is It Worth It?

Free Web Hosting and Domain Name with cPanel: Is It Worth It?

Starting a website can feel overwhelming. You want to get online quickly, but the costs, technical setup, and…

Web Hosting Basics: Everything You Need to Know Before You Start

Web Hosting Basics: Everything You Need to Know Before You Start

When starting a website for any purpose, we encounter various terms, such as web hosting. You might have…

Free Web Hosting for Developers and Test Projects

Free Web Hosting for Developers and Test Projects

Are you a developer looking for free web hosting for developers that actually works for real projects? You’re…