# cPanel deployment

## Two layouts

**Layout A — document root points at `public/` (preferred).**

Upload the release outside the web root, then point the domain's document root at its `public/` directory. Application code, configuration and storage are then unreachable over HTTP by construction.

**Layout B — everything in `public_html`.**

Upload the whole release into `public_html`. The shipped root `.htaccess` forwards requests into `public/` and blocks direct access to `app/`, `config/`, `database/`, `storage/` and the rest.

In Layout B, `.htaccess` is a **security control**, not an optimisation. If your host ignores `.htaccess`, use Layout A or another host.

## Steps

1. **Create the database.** MySQL Databases → create a database and a user with `utf8mb4_unicode_ci`, and grant all privileges. Import nothing.
2. **Set the PHP version.** MultiPHP Manager → PHP 8.1 or newer. Confirm `pdo_mysql`, `json` and `session` in the extension selector; `mbstring` is recommended.
3. **Upload and extract** the release archive into the chosen location.
4. **Set the document root** if you are using Layout A.
5. **Open `/install`** and complete the form: database credentials, site name, public origin, administrator account.
6. **Verify the protections** if you used Layout B — see [Installation](../01-getting-started/INSTALLATION.md).
7. **Configure SMTP** and send the test email. See [SMTP on cPanel](../09-recipes/SMTP-CPANEL.md).
8. **Run diagnostics** — System → Diagnostics, or `php bin/doctor.php` if Terminal is available.

## Permissions

Standard cPanel ownership is fine. Directories `0755`, files `0644`. `storage/` must be writable by PHP. Never use `0777` — on a shared host that means every account on the machine.

## Cron

Not required. Sitemaps are generated live and there is no queue to drain.

## Subdirectory installs

To serve from `example.com/community/`, set `APP_BASE_URL=/community` once. See [Subdirectory install](SUBDIRECTORY-INSTALL.md).

## After going live

- Delete or lock the installer path; the application disables it after installation.
- Take the first backup and rehearse a restore. See [Backup and restore](../01-getting-started/BACKUP-RESTORE.md).
- Change the administrator path from the default if you want less automated noise. It is obscurity, not access control.
