Yes, hosting Laravel on shared hosting is absolutely viable for small apps, prototypes, and low-traffic business websites. While the “purist” developer community often insists that a framework as powerful as Laravel requires a VPS or Cloud environment, the reality for budget-conscious entrepreneurs and beginners is different. If you are building an MVP, a portfolio, or a small business tool, paying $20–$50/month for a managed VPS is often overkill.
The key to success isn’t avoiding shared hosting; it’s knowing how to configure Laravel to work within its resource constraints.
In this guide, we’ll cut through the dogma and provide a realistic cost-benefit analysis. You will learn how to evaluate if shared hosting is right for you, technical workarounds for common limitations (like running Composer without SSH), and step-by-step instructions to deploy your project successfully. Whether you are looking for cheap laravel hosting or just trying to save money in the early stages of your startup, this guide is your roadmap.
Table of Contents
The Laravel Hosting Dilemma: Why Everyone Recommends VPS
If you search Google or ask on developer forums, the advice is almost unanimous: “Don’t do it.” The standard recommendation is to use a VPS (Virtual Private Server) or services like Laravel Forge, DigitalOcean, or Laragon.
Why is the advice so one-sided?
- SSH Access: Most shared hosts disable SSH access for security, making it impossible to run standard terminal commands like
php artisan migrateorcomposer install. - Resource Limits: Shared hosting uses “CPU throttling.” If your script runs for more than 30–60 seconds, the process is killed to protect other users on the server.
- Permission Structure: You often cannot control file ownership and permissions at the system level, which can break Laravel’s cache and logging mechanisms.
However, for a small app serving fewer than 1,000 visitors a day, these limitations are manageable hurdles, not dead ends. If you are testing the waters without breaking the bank, shared hosting is a smart financial move.
Shared Hosting Readiness Checklist
Before you buy a plan or upload your files, you must ensure your host meets the technical requirements. Not all shared environments are created equal. Some hosts are built for WordPress and lack the specific PHP extensions Laravel needs.
Run your potential host through this checklist:
✅ PHP Version
Laravel 10.x and 11.x require PHP 8.1 or higher. Avoid hosts stuck on PHP 7.4 or 8.0.
✅ Required PHP Extensions
Ensure the following extensions are enabled (check the host’s “PHP Selector” in cPanel):
* OpenSSL
* PDO
* Mbstring
* Tokenizer
* XML
* Ctype
* JSON
* BCMath
✅ Database Support
Laravel supports MySQL, PostgreSQL, and SQLite. Most cheap hosts offer MySQL 5.7 or MariaDB, which works perfectly.
✅ Composer Support
While you can work around it, having a “Setup Composer” script in cPanel is a massive bonus.
Check your hosting provider’s PHP Selector to ensure extensions like BCMath and Mbstring are enabled.
If a host fails the PHP version check, move on. You cannot run modern Laravel on outdated PHP stacks. For recommendations on providers that meet these criteria, check out our list of the best shared hosting php services.
Cost Comparison: Shared Hosting vs. VPS for Laravel
For small business owners, the bottom line is often the deciding factor. Let’s look at the hard numbers over one year for a typical entry-level setup.
| Feature | Shared Hosting | Managed VPS / Cloud |
|---|---|---|
| Monthly Cost | $3.00 – $8.00 | $20.00 – $50.00 |
| Annual Cost | $36 – $96 | $240 – $600 |
| Server Management | Managed (Host handles updates) | Unmanaged (You are the sysadmin) |
| SSH Access | Rare (or paid add-on) | Standard |
| Scalability | Vertical (Upgrade plans only) | Vertical & Horizontal (Auto-scaling) |
| Traffic Capacity | ~10k – 50k visits/mo | ~100k+ visits/mo |
| Learning Curve | Low | High (Linux/CLI skills required) |
The Verdict: If you are in the “Validation Phase” of your startup, spending $600/year on server management is poor ROI. Start with shared hosting. If your app explodes in popularity, you can reinvent profits to upgrade to a VPS later.
This comparison highlights the key differences when looking at shared hosting vs vps laravel environments. The savings from shared hosting can be better spent on marketing or development in the early days.
How to Deploy Laravel on Shared Hosting (Step-by-Step Guide)
This laravel cpanel tutorial assumes you are using a standard cPanel environment. We will use the “File Manager” method since it is the most common denominator across hosting providers.
Step 1: Prepare Your Local Project
Before uploading, you need to make your application production-ready. Open your terminal on your local machine:
- Set the Application Key: Ensure your
APP_KEYis set in the.envfile. - Optimize Configuration: Run
php artisan config:cacheandphp artisan route:cache. - Disable Debug Mode: In your
.envfile, setAPP_DEBUG=false. Never deploy with debug mode on in a shared environment; it exposes sensitive server data to the public.
Step 2: Configure the Public Directory
This is the most critical step. On a VPS, you point your web server to the /public folder. On shared hosting, your domain’s root folder (usually public_html) is fixed.
- Zip your entire Laravel project locally.
- Upload the zip to your server’s
public_htmlfolder using the File Manager “Upload” feature. - Extract the zip.
- You will now see
app,vendor,public, etc., insidepublic_html. This is a security risk and will likely result in a 500 error.
The Fix:
Many shared hosts allow you to map your subdomain or addon domain to a subdirectory.
- Move your entire Laravel project (except the
publicfolder contents) into a folder namedlaravelabovepublic_html(e.g., inside the user root). - Create a subdirectory inside
public_html(e.g.,blogorapp). - Move the contents of your original
publicfolder into this new directory.
Step 3: Update Paths in index.php
Because we moved the core files out of the web root, the index.php file (now sitting in public_html/your-app/index.php) needs to know where to find the bootstrap files.
Edit index.php in the File Manager code editor:
Change:
require __DIR__.'/../vendor/autoload.php';
$app = require_once __DIR__.'/../bootstrap/app.php';
To (adjust the .. based on where you moved the core files):
require __DIR__.'/../../laravel/vendor/autoload.php';
$app = require_once __DIR__.'/../../laravel/bootstrap/app.php';
Note: Ensure your paths point exactly to where the vendor folder and bootstrap folder reside on the server.
Step 4: The .env File
Shared hosts often hide the .env file in the File Manager because it starts with a dot.
- Rename your local
.envfile to something temporary likeenv.txtbefore uploading. - Upload it to the root Laravel directory (where
appandvendorare). - In cPanel File Manager, rename
env.txtback to.env. - Update your database credentials (
DB_DATABASE,DB_USERNAME,DB_PASSWORD) in this file to match the database you created in cPanel > MySQL Database Wizard.
Mapping your directory structure correctly is vital for security and functionality.
The Composer Problem: How to Install Dependencies Without SSH
One of the biggest hurdles developers face is the question: Can I run Laravel Composer on shared hosting? Usually, no. You don’t have terminal access to run composer install.
The Workaround:
Since your local computer already has the vendor folder, you simply upload it.
- Run
composer install --no-devon your local machine. This ensures you are only uploading production dependencies (PHPUnit, etc., are excluded). - Include the
vendorfolder in your zip file and upload it to the server. - Ensure the
vendorfolder has the correct permissions (usually 755).
Pro Tip: If your host does offer a “Terminal” icon in cPanel or a “Setup Composer” script in the software section, you can run commands there. However, the manual upload method is the most reliable “universal” solution for beginners.
Optimizing Laravel for Shared Hosting
Because resources are shared, you must be efficient. If your app is slow, it affects everyone on the server, and your host might suspend your account. Here is how to optimize laravel for shared hosting:
- Use OPCache: Ensure your host has OPCache enabled. This stores compiled PHP script bytecode in memory, drastically speeding up execution.
- Database Connection Limits: Shared hosts often cap the number of concurrent database connections (e.g., 10 or 20). Use.env settings to ensure your database connection is persistent only if necessary, or ensure connections are closed promptly.
- Avoid Heavy Queues: Standard shared hosting cron jobs are limited. If you need to process thousands of queued jobs, shared hosting will fail. Use database drivers for queues with simple tasks, or offload heavy processing to a service like AWS SQS if your app scales.
For deeper technical insights on squeezing performance out of your code, read our guide on how to optimize laravel performance.
Setting Laravel Storage Permissions for Shared Hosts
Incorrect permissions are the #1 cause of the “500 Internal Server Error.”
On a shared host, you generally cannot chown files. Instead, use the cPanel File Manager permissions tool:
- Directories:
755 - Files:
644 - Special Folders: The
storageandbootstrap/cachedirectories need to be writable by the web server. Set these to755or775. Never set permissions to 777, as most modern security extensions (like CloudLinux) will block this entirely for security reasons.
Configuring Laravel Cron Job on Shared Hosting
Your app likely needs to run scheduled tasks (like cleaning up logs or sending emails).
- Go to cPanel > Cron Jobs.
- Set the interval to “Once Per Minute” (
*). - In the command field, enter the path to PHP. This varies by host but is usually found under “Software Setup” or “Select PHP Version”:
php /home/yourusername/public_html/your-app-folder/artisan schedule:run >> /dev/null 2>&1
Replace yourusername and folder paths with your actual details.
When to Upgrade: Signs You’ve Outgrown Shared Hosting
While feasible, hosting Laravel on shared hosting is not forever. You will eventually hit a ceiling. Watch out for these signs that it’s time to migrate to a VPS:
- CPU Throttling Warnings: If you receive emails from your host stating your account is using “excessive resources,” your app is too heavy for the shared environment.
- Slow Database Queries: As your dataset grows, shared database servers (often housing thousands of other databases) will become a bottleneck.
- Need for Long-Running Processes: If you are using Laravel Queues to process video conversion or large CSV imports, you need a VPS where
php artisan queue:workcan run as a background process without timing out.
If you are seeing these signs, it is time to read our deep dive into shared hosting vs vps to plan your migration strategy.
FAQ
Does Laravel require a VPS?
No, Laravel does not strictly require a VPS. It runs perfectly fine on shared hosting as long as PHP requirements (version 8.1+) and necessary extensions are met. It is a viable solution for small apps, portfolios, and MVPs where traffic is low and budget is a constraint.
Is shared hosting good for PHP frameworks?
Yes, shared hosting is good for lightweight PHP frameworks and applications. However, frameworks with heavy overhead or specific server-configuration needs (like Laravel) require specific manual configurations (such as directing the webserver to the /public directory) to work efficiently on shared servers.
How to deploy Laravel on cPanel step by step?
To deploy Laravel on cPanel, you typically compress your project files, upload them via File Manager, and move the application files above the public_html directory for security. You then move the contents of the /public folder into public_html and update the index.php paths to point to the new location of the vendor and bootstrap folders. Finally, you set up your .env file and run database migrations via a URL or PHP script if terminal access is unavailable.
Why is Laravel slow on shared hosting?
Laravel may feel slow on shared hosting due to limited CPU resources (“throttling”), lack of HTTP/2 or HTTP/3 support on older servers, and the inability to use server-level caching tools like Redis or Varnish. Additionally, the overhead of loading hundreds of files on each request can be slower on shared hard drives (HDD) compared to the SSDs/NVMe drives found on VPS plans.
Can I run Laravel Composer on shared hosting?
Most shared hosting environments do not provide SSH access, preventing you from running composer install directly. The workaround is to install dependencies locally (composer install --no-dev) and upload the vendor folder along with your code. Some modern cPanel hosts do offer a “composer” interface or terminal access, but you should always be prepared for the manual upload method.
Conclusion
You don’t need a $40/month server to launch your dream project. Hosting on a shared environment is a smart, budget-conscious choice for validating your ideas and serving small audiences. By following the technical workarounds outlined above—specifically how to handle the public directory and composer dependencies—you can successfully deploy laravel on shared hosting without compromising on security or functionality.
Focus on building a great application first. Scale your infrastructure only when your user base and revenue justify it.
Ready to get started without spending a fortune? Check out our top recommendations for the best shared hosting php providers that are fully compatible with Laravel applications.