Laravel Deploy on BigRock After Git Pull (Composer, Migrate & Caches)

Laravel Deploy on BigRock After Git Pull (Composer, Migrate & Caches)

Series — BigRock Git Deploy (2 of 2+). Prerequisite: Part 1 — GitHub to BigRock Git setup (PAT). This post is Laravel-only after a successful pull. Future posts can cover other stacks the same way.

Introduction

git pull on BigRock worked. The site still looks wrong, cached, or broken. That usually means Git is fine—and the Laravel post-pull steps were skipped.

This guide assumes Part 1 is done: GitHub is the source of truth, BigRock only pulls, and auth (PAT or deploy key) is valid. Here we cover what to run for a Laravel app on cPanel/BigRock every time you deploy.

Before you start

  • You can git pull without auth errors
  • Project path on the server is known (cPanel Git path)
  • You will not commit or overwrite production .env from Git

If pull still fails, fix Part 1 first—do not debug Artisan yet.

Document root and project layout

Laravel’s web entry is public/index.php. On BigRock / cPanel:

  • Point the domain (or subdomain) document root to the project’s public/ folder
  • Do not expose the project root (where .env, vendor/, and app/ live) as the public web root

If Git lives in ~/laravel-app and the site should open from that app, the docroot should be something like ~/laravel-app/public (exact path depends on your account).

Keep secrets on the server

  • .env stays on BigRock — create/edit it once on the server
  • Never commit real secrets; keep .env in .gitignore
  • After pull, do not replace production .env with a local development file
  • If you add new env keys in code, add them manually on the server, then rebuild config cache

Laravel post-pull checklist

From the project root on BigRock:

cd ~/path/to/YOUR_LARAVEL_REPO

# 1) PHP dependencies (production)
composer install --no-dev --optimize-autoloader

# 2) Database schema (only when migrations changed)
php artisan migrate --force

# 3) Rebuild caches
php artisan config:cache
php artisan route:cache
php artisan view:cache

# 4) Front-end assets (pick one approach)
# If Node exists on the host:
#   npm ci && npm run build
# If not: build locally/CI and deploy public/build with your release process

Why each step matters

  • Composer — new packages/classes will 500 without vendor/ updated; use --no-dev on production
  • Migrate — code that expects new columns fails until schema matches
  • Config/route/view cache — old cached config is a classic “pull worked, site unchanged / wrong settings” cause
  • Assets — Vite/Mix builds are not created by git pull alone unless you commit build output on purpose

Permissions

The web user must write to:

  • storage/ (logs, cache, uploads, sessions if file-driven)
  • bootstrap/cache/ (config/route/view cache files)

If pages fail with permission errors after deploy, fix ownership/permissions for those directories rather than chmod’ing the whole repo to 777.

Simple deploy.sh (optional)

#!/usr/bin/env bash
# Example only — adjust paths/branch for your BigRock account
set -e
cd "$HOME/path/to/YOUR_LARAVEL_REPO"
git pull origin main
composer install --no-dev --optimize-autoloader
php artisan migrate --force
php artisan config:cache
php artisan route:cache
php artisan view:cache

Make it executable and run it after you push from local. Keep tokens out of this script—Git auth should already work via Part 1 (origin URL or SSH key).

Day-to-day Laravel deploy flow

  1. Local: commit + git push
  2. BigRock: git pull (or cPanel Update from Remote)
  3. Run Composer + migrate (if needed) + caches
  4. Build or sync front-end assets
  5. Smoke-test: home page + one authenticated / admin page

Troubleshooting (Laravel after pull)

Symptom Likely cause Fix
500 after pull Missing vendor, bad .env, cache, permissions composer install --no-dev; check storage/logs; rebuild caches
Pull works, old config/behavior Stale config:cache php artisan config:clear then config:cache
CSS/JS missing Assets not built on server Run npm run build or deploy public/build
Site shows wrong folder / listing Docroot not public/ Point domain document root to public/
Upload/log errors storage/ or bootstrap/cache not writable Fix permissions for those paths

Security reminders (Laravel on shared hosting)

  • Keep APP_DEBUG=false in production
  • Never commit .env
  • Do not leave phpinfo() or open installers in public/
  • Rotate DB/API keys if they were ever committed or pasted into chat

Where this sits in the series

  • Part 1 — GitHub ↔ BigRock auth and pull (any stack)
  • Part 2 (this post) — Laravel after pull
  • Later (planned) — same pattern for other technologies (for example Node/Express, WordPress, static/Vite sites)

Conclusion

On BigRock, a Laravel deploy is two jobs: get the code (Part 1), then build the app state (this post). Pull, Composer, migrate when needed, refresh caches, fix docroot and permissions, and smoke-test. Automate that list with a small deploy.sh once it feels repetitive.

Quick path: pull → composer install --no-dev → migrate if needed → config/route/view cache → assets → verify site.

Series navigation: Previous: Part 1 — Git setup · You are on Part 2 (Laravel)

Further reading

Topics
Development Laravel