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
Türkiye Türkçe
Vietnam English
Thailand English
South Korea English
Australia English
China 中文
Canada English
Canada Français
Somalia English
Netherlands Nederlands

Can You Host Laravel on Shared Hosting?

Yes, you can run Laravel on shared hosting, provided your hosting account supports the PHP version, extensions, database, and server features your application needs.

You don’t always need to pay for a VPS or have full server access to get a Laravel application online.

However, shared hosting has limitations that can affect how your application runs, particularly if it needs background jobs, scheduled tasks, or additional server resources.

Before choosing a hosting plan in Uganda, check what Laravel needs, how deployment works, and when upgrading to VPS hosting makes more sense.

What Does Laravel Need From a Hosting Plan?

Your hosting environment must meet Laravel’s technical requirements for the application to work correctly. Start by checking the following:

1) PHP Version and Extensions

Start by checking the PHP version supported by your hosting provider. Different Laravel releases have different PHP requirements. For example, Laravel 13 requires PHP 8.3 or newer.

Laravel on Shared Hosting: PHP Version

You’ll also need essential PHP extensions, including Ctype, cURL, DOM, Fileinfo, Filter, Hash, Mbstring, OpenSSL, PCRE, PDO, Session, Tokenizer, and XML.

Most shared hosting control panels provide a PHP selector, allowing you to choose the version your website uses. However, this doesn’t guarantee that every required extension is available.

Check the extensions supported by your preferred plan before purchasing. You can also consult the official Laravel deployment documentation for the requirements of your Laravel release.

2) Database Support

Laravel supports MariaDB, MySQL, PostgreSQL, SQLite, and SQL Server. MySQL or MariaDB is a common choice for shared hosting.

You’ll need to create a database, obtain its connection details, and add them to your application’s .env file.

For example:

DB_CONNECTION=mysql
DB_HOST=localhost
DB_PORT=3306
DB_DATABASE=your_database
DB_USERNAME=your_username
DB_PASSWORD=your_password

Make sure the database connection settings match those provided by your hosting provider.

3) Application Directories and Permissions

Laravel has a specific directory structure that you need to maintain during deployment.

  • Keep the main application files outside public web access.
  • Configure the web server to serve files from Laravel’s public directory.
  • Ensure the storage and bootstrap/cache directories are writable.
  • Confirm that your hosting provider permits the file operations your application needs, including symbolic links.

These permissions allow Laravel to save logs, upload files, and store cached data. Without them, your application may return errors or fail to perform certain operations.

Can You Deploy Laravel Without SSH or Composer?

Yes. You can prepare your Laravel application locally and upload it through cPanel File Manager or FTP. However, SSH and Composer make deployment and maintenance easier.

Laravel on Shared Hosting: SSH

Deploying Without SSH

If your shared hosting plan doesn’t provide terminal access, you can prepare the application on your computer before uploading it.

The process works like this:

  1. Prepare the application locally: Install the required dependencies using Composer on your computer. If your application uses Vite, build the frontend assets using Node.js and npm.
  2. Prepare production files: Run composer install --no-dev --optimize-autoloader locally to install the production dependencies.
  3. Upload the project: Compress the application into a ZIP file and upload it through cPanel File Manager or FTP.
  4. Create a database: Use cPanel to create a MySQL database and use it to import an existing SQL backup through phpMyAdmin if necessary.
  5. Configure the application: Update the .env file with production settings, database credentials, and the application URL.
  6. Configure the public directory: Point your domain to Laravel’s public directory or use a secure alternative if your provider doesn’t allow document-root changes.
  7. Test the application: Visit your domain and check that pages load, database connections work, and file uploads function correctly.

This approach works for applications that don’t require frequent server-side commands. Without terminal access, though, you’ll need another way to run migrations, clear caches, and perform other Artisan operations.

For database migrations, you can run them locally and import the resulting SQL into your production database.

Avoid creating a publicly accessible URL that triggers migrations because this can expose your database to unauthorized changes.

Deploying With SSH and Composer

If your hosting plan offers SSH access, deployment becomes easier to manage from the server. You can connect to your hosting account through a terminal and use Git to upload or update your application.

A normal deployment involves:

  1. Uploading or cloning the project using Git.
  2. Installing production dependencies using composer install --no-dev --optimize-autoloader.
  3. Configuring production environment variables.
  4. Running database migrations using php artisan migrate --force.
  5. Creating the storage link using php artisan storage:link.
  6. Optimizing the application using Artisan commands such as php artisan config:cache and php artisan route:cache.

SSH also makes troubleshooting and future updates easier because you can run commands directly instead of repeatedly uploading ZIP files.

Before choosing this approach, confirm that your hosting plan supports SSH, Composer, and the required command-line permissions.

How Do You Configure Laravel on Shared Hosting?

One of the bigger challenges when deploying Laravel on shared hosting is configuring the document root correctly.

Most shared hosting accounts use a directory called public_html as the default location for website files. Laravel, however, expects the web server to serve files from its own public directory.

Laravel on Shared Hosting: Directory

You have two common ways to handle this.

1) Point the Domain to Laravel’s Public Directory

The preferred approach is to change your domain’s document root to Laravel’s public directory.

For example, if your application is stored in:

/home/username/laravel-app/

Set the document root to:

/home/username/laravel-app/public/

This allows visitors to access the application through its intended entry point without exposing the rest of the project.

2) Use a Separate Public Folder

If your hosting provider doesn’t allow document-root changes, you can use public_html as the public-facing directory.

Follow these steps:

  1. Keep the main Laravel application outside public_html.
  2. Copy the contents of Laravel’s public directory into public_html.
  3. Update the paths in public_html/index.php to point to the application’s actual vendor/autoload.php and bootstrap/app.php files.

This alternative may require additional storage-path adjustments because Laravel may still reference its original public directory.

Never upload the entire Laravel project into a publicly accessible directory or move index.php into the project root. This could expose sensitive application files.

Protect Application Files

Your .env file contains sensitive information like database credentials, application keys, and more. Keep it outside public web access, and set your production environment correctly:

APP_ENV=production
APP_DEBUG=false

Leaving APP_DEBUG=true on a live website can expose sensitive application details whenever an error occurs.

Use appropriate file permissions to allow Laravel to write to the required files and directories, and avoid setting permissions to 777, which grants everyone write access and creates unnecessary security risks.

Configure Storage and Cache

Laravel needs write access to the storage and bootstrap/cache directories.

You can create the symbolic link for public file storage using:

php artisan storage:link

This links storage/app/public to public/storage, allowing visitors to access files stored in the application.

However, some shared hosting providers restrict symbolic link creation. If you’re using the separate public folder method, the default link may also point to the wrong directory.

Check if your provider permits symbolic links and test file uploads and public file access after deployment.

What Are the Limitations of Running Laravel on Shared Hosting?

Even when your Laravel application runs successfully on shared hosting, the account-level restrictions of that environment may affect some of its features.

These limitations become more important when you’re building an application that handles frequent requests, processes large files, or runs background tasks.

Laravel on Shared Hosting: Limitations

a) Background Jobs and Queue Workers

Laravel queues handle time-consuming tasks such as sending emails, processing documents, and generating reports. Instead of making visitors wait for these operations to finish, Laravel places them in a queue for background processing.

Queue workers normally run continuously, and Laravel recommends using a process monitor such as Supervisor to keep them running and restart them when necessary.

Basic shared hosting environments may restrict persistent background processes, making it difficult to run queue workers continuously.

One possible workaround is to use a cron job to execute:

php artisan queue:work --stop-when-empty

This processes pending jobs and exits when the queue is empty. However, it doesn’t replace a persistent worker and depends on your hosting provider allowing the required commands and execution time.

Applications that depend heavily on background processing are generally better suited to VPS hosting.

b) Scheduled Tasks and Cron Jobs

Laravel’s scheduler automates recurring tasks such as sending reminders, publishing scheduled content, and cleaning up old database records.

Laravel recommends adding a cron job that runs php artisan schedule:run every minute:

* * * * * cd /path-to-your-project && php artisan schedule:run >> /dev/null 2>&1

However, some shared hosting providers impose longer cron intervals or restrict executable commands.

For example, if your hosting plan only allows cron jobs to run every five or fifteen minutes, tasks that need to execute every minute may not run as scheduled.

Check your provider’s cron job policy before relying on Laravel’s scheduler.

c) Server Resources and Advanced Features

Shared hosting divides server resources among multiple accounts, with each plan having its own usage limits.

Intensive database queries, large file uploads, and simultaneous requests can put pressure on these limits. If your application regularly reaches its allocated limits, you may experience slow response times or failed operations.

Advanced features such as Redis, Laravel Horizon, Octane, and WebSockets may also require additional services or server configuration.

Confirm their availability with your hosting provider before building your application around them.

When Should You Choose Shared Hosting or Upgrade to a VPS?

Your application’s requirements should guide your hosting decision.

Choose shared hosting if:

  • You’re running a small Laravel application.
  • Your application has modest resource requirements.
  • It doesn’t depend on persistent background workers.
  • Your plan supports the required PHP version, extensions and database.
  • You can work within the provider’s process and resource limits.

Consider VPS hosting if:

  • Your application needs persistent queue workers.
  • You require Redis, Supervisor, WebSockets or other advanced features.
  • You need greater control over PHP and server configuration.
  • Your application regularly reaches shared hosting resource limits.
  • You’re building a larger application that needs room to grow.

You don’t need a VPS simply because you’re using Laravel. Choose based on your application’s actual requirements and expected workload.

Host Your Laravel Application With the Right Hosting Environment

If you’re starting with a small Laravel application, take a look at our Truehost Shared Hosting plans and check which option fits your project’s requirements.

We provide cPanel-based hosting with tools for managing website files, databases, and other hosting tasks. 

Before ordering, contact our support team to confirm the PHP version, required extensions, SSH and Composer availability, cron frequency, symbolic link permissions, and applicable resource limits for your preferred plan.

If your application needs persistent background processes, custom server configurations, or more control over allocated resources, consider Truehost VPS Hosting.

Choose a hosting plan that gives your Laravel application the environment it needs to run reliably and grow.

Author

Leave a comment

Your email address will not be published. Required fields are marked *