Spring Fresh Sale! - Up To 67% OFF BDIX Hosting + Free Domain
Scripts & Apps

How to Install Laravel on cPanel Shared Hosting

Laravel is the most popular PHP framework, and it runs happily on cPanel shared hosting once you handle one quirk: Laravel expects the web server to serve from its public folder, not the project root. Point things correctly and your app runs cleanly. Here is the reliable way to do it.

Before you start

Confirm your hosting runs a PHP version Laravel supports (a current release needs a recent PHP). You will also want SSH access to run Composer and Artisan commands.

Step 1: Upload your project

Build and test locally, then upload the whole project above your public folder — for example to /home/username/laravel-app, not inside public_html. You can zip it, upload via File Manager, and extract, or push it with Git in cPanel.

Step 2: Point the domain at the public folder

Two common approaches:

  • Set the document root to your app's public folder. For an addon domain you can choose this when creating it; see finding your document root.
  • Or move the contents of public into public_html and edit the paths in index.php to point back to your app folder.

Setting the document root to public is the cleaner option and keeps your app code out of the web-accessible area.

Step 3: Configure the app

  1. Create your .env file and set the app URL and database details.
  2. Create a MySQL database and user and add them to .env.
  3. Over SSH, run composer install --no-dev, then php artisan key:generate and php artisan migrate.

Frequently asked questions

Can I run Composer if I do not have SSH?

Some plans include a Composer tool in cPanel, but SSH is far smoother for Laravel. If you cannot use SSH, run Composer locally and upload the finished vendor folder with your project.

My app shows a blank page or 500 error.

Check file permissions on storage and bootstrap/cache (they must be writable), confirm the document root points to public, and read the log in storage/logs. See fixing file permissions.

Is shared hosting enough for Laravel?

For small to medium apps, yes. Heavier applications with queues, websockets or high traffic are better on a VPS where you control the environment fully.

Was this article helpful?