Knowledgebase

Deploying on cPanel: Everything That Matters, Briefly Print

  • phplaravel, cpanel, errors, cron, caching, database, php, migration, hacked, uploads
  • 0

The summary.

NEVER UPLOAD A LARAVEL PROJECT INTO THE PUBLIC DIRECTORY AS IT STANDS

Everything outside the public folder becomes browser-reachable, including your configuration file with database credentials and keys.

Place the application outside the served directory, put the public contents in it, and adjust the entry point's paths.

Then try requesting your configuration file in a browser. It must not be served.

SPECIFY THE PHP VERSION EXPLICITLY IN THE TERMINAL AND IN CRON

The terminal default frequently differs from the version serving your site, and cron inherits nothing.

THE MOST COMMON DEPLOYMENT REPORT

Changes not taking effect, because configuration and routes are cached. Rebuild them after every deployment.

ONLY STORAGE NEEDS TO BE WRITABLE

Never broaden permissions to clear an error — the error is then replaced by a compromise.

DEPLOY IN ORDER

Back up, deploy code, install dependencies, migrate, rebuild caches, restart workers, verify.

CHECK THE STORAGE LINK AFTER EVERY DEPLOYMENT

It is a common silent breakage.

WHEN SOMETHING FAILS

The storage log directory first, then the server error log. Debug is off in production, so the browser tells you nothing.


Was this answer helpful?
Back

Are you happy with your experience? Leave us a review on Trustpilot.


Trustpilot