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?

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 Type | Cost (KES/mo) | Best For |
| Shared | 300–800 | Small sites |
| VPS | 1,500+ | Growing apps |
| Dedicated | 5,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:
- Low Cost
You do not need to spend on a VPS. A simple KES 399 plan from Truehost is enough for many apps. - Easy to Use
You can upload and manage your site using simple cPanel tools. You do not need command-line experience. - 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.

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.
- Create a new database
- Create a new user with a strong password
- 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

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
| Problem | Cause | Fix |
| 500 Error | Wrong permissions | Use 755 and 644 |
| Missing routes | No .htaccess | Add rewrite rules |
| Slow site | Cache issues | Clear cache |
| DB errors | Wrong .env | Check 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.
Domain SearchInstantly check and register your preferred domain name
Web Hosting
cPanel HostingHosting powered by cPanel (Most user friendly)
KE Domains
Reseller HostingStart your own hosting business without tech hustles
Windows HostingOptimized for Windows-based applications and sites.
Free Domain
Affiliate ProgramEarn commissions by referring customers to our platforms
Free HostingTest our SSD Hosting for free, for life (1GB storage)
Domain TransferMove your domain to us with zero downtime and full control
All DomainsBrowse and register domain extensions from around the world
.Com Domain
WhoisLook up domain ownership, expiry dates, and registrar information
VPS Hosting
Managed VPSNon techy? Opt for fully managed VPS server
Dedicated ServersEnjoy unmatched power and control with your own physical server.
SupportOur support guides cover everything you need to know about our services








