deployment and operations

Shared Hosting

Shared hosting can run a small PHP site without asking the application developer to administer a server. The provider usually exposes a control panel, a file upload path, database credentials, and a choice of PHP versions. That simplicity is useful, but it also limits which deployment techniques are available.

Before deploying, check the provider rather than assuming it behaves like your local machine. A host may support PHP web requests but not long-running queue workers. It may expose cron jobs but restrict their frequency. Extensions, upload limits, log access, and the public document root can also differ between plans.

Keep Private Files Outside The Web Root

Only files intended for direct browser access belong beneath the public document root. Source code, Composer metadata, environment configuration, logs, and private uploads should stay outside it. If the provider forces a directory such as public_html/, place the application entry point and public assets there and keep the rest of the project above that directory where the account layout allows it.

account/
  app/
    src/
    vendor/
    .env
  public_html/
    index.php
    build/

The exact layout varies by provider. The rule does not: a browser request must not be able to download secrets or application source files.

Prove The Hosting Plan Fits The App

Confirm the PHP version and extensions from the serving runtime, not only the provider panel. Locate error logs before release. Check how environment-specific secrets are stored, how database migrations run, how backups are restored, and whether a previous release can be put back quickly.

public document root: public/
PHP version: verify in provider panel and runtime
secrets: provider environment or protected config outside public/
cron: confirm provider support
logs: locate before release

Shared hosting is a reasonable choice when the application fits those constraints. It becomes a poor fit when the project needs daemons, custom server packages, complex background processing, or deployment controls the provider does not expose.

Practice

Practice: Review A Shared-Hosting Deployment

You are moving a small contact-management app from local development to a shared host. Write a pre-deployment check that would reveal whether the hosting plan is suitable.

Requirements

  • Confirm supported PHP version, extensions, document root, and database access.
  • Use environment-specific secrets outside committed files.
  • Understand upload, cron, process, and log limitations.
  • Deploy only public files beneath the web root.
  • Run migrations and backups through supported tools.
  • Verify HTTPS, error display, logs, and rollback.
Show solution

The app also needs an operating path. Record how to run migrations, locate logs, restore a backup, and return to a previous release. If the app relies on queue workers or custom server packages, shared hosting is probably the wrong deployment model rather than a problem to work around silently.