# Installation guide

## Minimum requirements

| Component | Requirement |
|---|---|
| PHP | 8.1+ (8.3 recommended) with `mysqli`, `mbstring`, `json`, `openssl`; `curl` for webhooks; `gd`/`getimagesize` for logo checks |
| Database | MySQL 8.0+ or MariaDB 10.6+, InnoDB, utf8mb4 |
| Web server | Apache 2.4 with `mod_rewrite` (and `mod_headers` recommended); nginx works with an equivalent rewrite to `public/index.php` |
| HTTPS | Required for production (sessions are HTTPS-only cookies; HSTS is sent) |
| Cron | One job every 1–5 minutes |
| Disk | ~5 MB code + database + logs/uploads |

## Option A — Browser installer (recommended)

1. Upload `SyncInfinite_POS_Complete_Production.zip` and extract it **outside** the public web folder, e.g. `/home/USER/syncinfinite-pos/`.
2. Point the domain/subdomain document root to `/home/USER/syncinfinite-pos/public` (see DEPLOYMENT.md for cPanel).
3. Make `storage/` writable by PHP (`chmod -R 750 storage`; on suPHP/PHP-FPM hosts files run as your user).
4. Create an empty MySQL database and user with ALL PRIVILEGES on that database.
5. Visit `https://pos.example.com/install/`.
6. Enter the one-time **setup key** from `storage/install.key` (cPanel → File Manager).
7. Review the requirement checks → enter database, URL, environment, optional SMTP, and the **Super Admin** account (password ≥ 12 chars — there are no default passwords).
8. Choose **Clean** (production) or **Demo** (refused when environment = production).
9. On success the installer writes `.env` (mode 600), creates tables, seeds permissions/roles/example plans, creates the Super Admin and writes `storage/installed.lock`. Re-running is blocked. You may delete `public/install/`.

## Option B — Manual (phpMyAdmin)

1. Create the database, open phpMyAdmin → Import → `database/schema.sql`.
2. Copy `.env.example` to `.env` and fill in `DB_*`, `APP_URL`, a random 64-hex `APP_KEY`.
3. Visit `/install/`; the wizard detects the existing tables and only seeds (permissions, plans, Super Admin).

## Option C — Command line (VPS)

```
cp .env.example .env && nano .env
php installer/cli.php install --admin-email=you@syncinfinite.com --admin-password='a-long-unique-pass' [--demo]
```

## After installing

- Add the cron job (DEPLOYMENT.md §Cron).
- Sign in at `/login` with the Super Admin account → `/admin`.
- Review `/admin/plans`: example plan prices are placeholders, not commercial prices.
- Keep `PAYMENTS_SIMULATOR_ENABLED=false` and `DEMO_MODE=false` in production.
- Edit the placeholder legal pages with counsel before launch.
