Blog · WebJi® India

How to Install Laravel on cPanel

Quick answer: Laravel installs on cPanel in four moves: create the project with Composer in Terminal, set a subdomain's document root to the project's public folder, add database credentials and APP_URL to .env, then run php artisan key:generate and php artisan migrate. The install is done when the Laravel welcome page loads at that subdomain.
✓ In business since 2005✓ INR + GST billing✓ 24/7 Email Support — avg reply < 60 min
Indian man's hands typing on a laptop with a metal padlock beside it, symbolising HTTPS security — how to install laravel on cpanel

What Laravel needs before the first Composer command

Laravel 11 and 12 need PHP 8.2 or newer and Composer 2. On a cPanel account both are reachable from the panel: PHP from MultiPHP Manager, Composer from Terminal. Check the five items below before you type anything, because a missing one is what most failed installs turn out to be.

RequirementWhere to check in cPanelWhat to do if it is missing
PHP 8.2, 8.3 or 8.4Software, then MultiPHP ManagerSet the domain to an 8.2+ handler. Laravel 12 will not boot on 8.1.
Composer 2Advanced, then Terminal: composer --versionInstall the composer.phar in your home directory and call it with php composer.phar.
MySQL or MariaDB databaseDatabases, then MySQL DatabasesCreate the database and a user, then add the user to it with All Privileges.
A domain or subdomain you can aimDomains, then Create A New DomainUse a subdomain. A shared account cannot move the main domain's document root.
Terminal accessAdvanced, then TerminalIf the icon is absent, your plan has no shell. Build locally and upload vendor/ and public/.

Two habits save an afternoon. Run every command as the cPanel user, never as root, and keep the project outside public_html so only the public folder is reachable over HTTP. A cPanel hosting account with Terminal access covers all five rows.

Create the project with Composer in Terminal

The project is created with one Composer command inside your home directory, not inside public_html. Open Terminal from the Advanced section of cPanel and work through these steps in order.

  1. Run cd ~ so you are in your home directory, then confirm the PHP binary with php -v. It should report 8.2 or higher.
  2. Run composer create-project laravel/laravel myapp. Composer downloads the skeleton and its dependencies; expect two to four minutes on a shared account.
  3. Run cd myapp and then php artisan --version. You know the create step worked when it prints a Laravel Framework version such as 12.x.
  4. Run php artisan about. It lists the PHP version, cache driver, and environment Laravel is actually using, which is the quickest way to catch a wrong PHP handler.

If Composer stops with a message that ext-fileinfo is missing from your system, the PHP build selected for that domain is short of an extension. Switch the domain to another 8.2+ handler in MultiPHP Manager and rerun the create command. If Composer runs out of memory, prefix the command with php -d memory_limit=512M /usr/local/bin/composer instead of raising the account limit for every script.

Aim a domain at Laravel's public folder

Laravel must be served from its public directory. Everything above that folder holds .env, logs, and source code, and none of it should be reachable by a browser. How you arrange that depends on which domain you use.

Domain typeWhere the Laravel folder sitsDocument root to set
Subdomain (recommended)/home/your-username/myapp/home/your-username/myapp/public
Addon domain/home/your-username/myapp/home/your-username/myapp/public
Main domain on shared hosting/home/your-username/myappCannot be changed away from public_html

For a subdomain, open Domains, then Create A New Domain, enter app.example.com, untick the share-document-root box, and type the public path as the document root. For the main domain, copy the contents of public into public_html, then open public_html/index.php in File Manager and point its two require lines at the folder above, so they read ../myapp/vendor/autoload.php and ../myapp/bootstrap/app.php.

The check is simple: load the domain. You should see the Laravel welcome page, not a directory listing and not a 403. A listing means the document root is still the project folder; a 403 usually means an index file is missing from the folder you aimed at.

Connect MySQL and finish the .env file

The database is created in cPanel and described in .env; Laravel does not create it for you. In MySQL Databases, create a database, create a user with a strong password, and add the user to that database with All Privileges. Then edit .env in File Manager and set four values.

  • DB_DATABASE, DB_USERNAME, DB_PASSWORD from the screen you just used. cPanel prefixes both names with your account name, so copy them exactly.
  • APP_URL set to the full https address you will serve, for example https://app.example.com.
  • APP_ENV=production and APP_DEBUG=false before the site takes real traffic.

Back in Terminal, run php artisan key:generate to write APP_KEY, then php artisan migrate --force to create the tables. You know the database link works when migrate reports each migration as DONE and php artisan migrate:status lists them as Ran. When you change .env later, run php artisan config:clear, because cached configuration keeps the old values.

Permissions that survive a cPanel PHP handler

Laravel writes to two folders at runtime: storage and bootstrap/cache. Set folders to 755 and files to 644, and use 775 on those two folders only if the panel runs PHP through a handler that needs group write. Never use 777, and never leave index.php group-writable.

The failure this prevents has a specific log line: SoftException in Application.cpp: File .../public/index.php is writeable by group. That is a 500 caused by permissions alone. Fix it with chmod 644 public/index.php and chmod -R 755 public, then reload. If uploads or cache writes still fail, widen storage to 775 and test the feature that writes, not just the home page.

Blank page, 500 error, or Vite manifest error

Most first-deploy failures on cPanel fall into five shapes. Match the symptom, make one change, and reload the page before trying the next row.

SymptomUsual causeFix
500 with SoftException in the logindex.php or a folder is group-writablechmod 644 on files, 755 on folders, then reload
Blank white page, nothing in the logvendor/ missing or APP_DEBUG hiding the errorRead storage/logs/laravel.log, run composer install, set APP_DEBUG=true while testing
Vite manifest not found at public/build/manifest.jsonFront-end assets were never builtRun npm run build on your machine and upload the public/build folder
403 on every routeDocument root is the project folder, not publicRepoint the document root or fix the index.php paths
No application encryption key has been specifiedAPP_KEY is emptyRun php artisan key:generate in the project folder

One more thing to check before you blame the code: the PHP version that Terminal uses and the one Apache uses can differ. php -v in Terminal proves the command-line handler; MultiPHP Manager sets the web handler. If artisan runs cleanly while the browser throws errors, that mismatch is the first suspect.

What shared cPanel will not do for a Laravel app

Shared hosting runs your app on request, then stops it. That suits CRUD tools, dashboards, and brochure sites. It does not suit anything that must stay resident: queue workers under Supervisor, Laravel Horizon, websocket servers, or long scheduled jobs all need a process that outlives the request.

The workaround on shared is cron. Schedule php /home/your-username/myapp/artisan queue:work --stop-when-empty --max-time=50 once a minute, which drains the queue without overlapping runs. When queue depth, concurrent users, or an always-on worker become the normal load, move the same codebase to a VPS server with root access; WebJi quotes VPS and dedicated configurations by email at support@webji.services before you pay.

cPanel hosting from WebJi for Laravel projects

Our L-Developer plan is the one built for this job: more CPU and concurrent entry processes than the entry tiers, Terminal with Composer, and PHP 8.2+ selectable per domain. It is ₹700 per month before 18% GST, and every invoice carries our GSTIN. Account setup and migration are handled by email, not by a call centre.

Email support@webji.services with the Laravel version, the PHP version, and the exact error if an install stalls. Support is 24/7 by email in Hindi and English with an average first reply under 60 minutes. Plan details sit on the cPanel hosting page and the full list with billing cycles is on WebJi pricing.

Frequently Asked Questions

Can I install Laravel on cPanel shared hosting?

Yes. Create the project with Composer in cPanel Terminal, aim a subdomain's document root at the project's public folder, fill in the database values in .env, and run php artisan migrate. The limits are process-based: no resident queue workers, no websocket server, and no root access.

How do I point the document root to Laravel's public folder in cPanel?

Open Domains, then Create A New Domain, and set the document root to /home/your-username/myapp/public. For the main domain on a shared account the root is fixed at public_html, so copy the contents of public into public_html and edit the two require lines in index.php to point at ../myapp.

Do I need SSH, or is cPanel Terminal enough?

Terminal is enough for Composer, artisan, and chmod, because it runs as your cPanel user. SSH is only needed for extras such as Git deploy hooks or rsync, and not every shared plan enables it. If the Terminal icon is missing from Advanced, your plan has no shell access.

Why does my Laravel site show a 500 error on cPanel?

Read the newest line under Metrics, then Errors. The most common cPanel-specific cause is a group-writable index.php under a suPHP-style handler, which is fixed with chmod 644. Storage permissions, a missing vendor folder, and an empty APP_KEY cover most of the rest.

How do I fix Vite manifest not found on cPanel?

The message means public/build/manifest.json is missing, so Laravel cannot resolve the compiled CSS and JavaScript. Run npm install and npm run build on your own machine, then upload the generated public/build folder. Shared hosting rarely has Node available, so building on the server is not the intended path.

Does Laravel 12 run on PHP 8.1?

No. Laravel 11 and 12 require PHP 8.2 or newer, and Composer will refuse to install them on 8.1. Set the domain to an 8.2, 8.3, or 8.4 handler in MultiPHP Manager before you create the project, and check the same version with php -v in Terminal.

Need help with this?

WebJi® support does it for you — free. Talk to our Jaipur team →