# Local Development Setup

How to run the Voice Clone microsite on this Windows machine. Everything is a
portable, no-admin install that lives **outside** the repo.

## What's installed

| Tool | Version | Location | Notes |
|------|---------|----------|-------|
| PHP  | 8.3.32 (CLI, x64) | `C:\Users\davte\php` | On user PATH. `php.ini` has `pdo_mysql`, `mysqli`, `openssl`, `curl`, `mbstring`, `fileinfo`, `gd` enabled. |
| MariaDB | 11.8.8 (LTS) | `C:\Users\davte\mariadb` | MySQL-compatible drop-in. Data dir: `...\mariadb\data`. root has no password, port 3306. |

> **MariaDB, not Oracle MySQL:** Oracle blocks scripted downloads, so we used
> MariaDB — the community fork. It speaks the same protocol, uses the same
> `mysql:` PDO driver, and runs `sql/schema.sql` unchanged. Swap in official
> MySQL later if a contract requires it; the schema and data are compatible.

## Antivirus note (important)

This machine runs **PC Matic Super Shield**, a whitelist ("default-deny")
antivirus. It blocks unrecognized/unsigned `.exe`s with a bare
"Access is denied". If a newly installed tool won't run, add its folder to
PC Matic's **SuperShield → Local Allow List** (or "Always Allow" it from the
block log). PHP needed this; MariaDB's signed binaries were allowed automatically.

## Running the site

Open **two** terminals:

```powershell
# Terminal 1 — database (leave running)
.\scripts\start-db.ps1

# Terminal 2 — web server (leave running)
.\scripts\start-web.ps1
```

Then visit **http://localhost:8000** — you'll be sent to the login page.
Sign up at http://localhost:8000/signup.php.

Stop either server with **Ctrl+C** in its terminal.

## First-time database setup (already done, kept for reference)

```powershell
# 1. Initialize the data directory (root, no password, no Windows service)
& "C:\Users\davte\mariadb\bin\mariadb-install-db.exe" --datadir="C:\Users\davte\mariadb\data" --port=3306

# 2. Start the server (see start-db.ps1), then import the schema:
Get-Content sql\schema.sql -Raw | & "C:\Users\davte\mariadb\bin\mariadb.exe" -u root --host=127.0.0.1 --port=3306
```

## Connecting to the database manually

```powershell
& "C:\Users\davte\mariadb\bin\mariadb.exe" -u root --host=127.0.0.1 --port=3306 voiceclone
```

## Creating an admin login

Admins are a hardcoded list in `config/config.php` (there is no admin signup).
Generate a bcrypt hash for your chosen password, then paste it in:

```powershell
php -r "echo password_hash('your-strong-password', PASSWORD_DEFAULT);"
```

```php
// config/config.php
'admins' => [
    'dave@davekirwan.com.au' => '$2y$10$...paste the hash...',
],
```

Then log in at http://localhost:8000/admin/.

## Config credentials

`config/config.php` is set for this local DB: host `127.0.0.1`, port `3306`,
db `voiceclone`, user `root`, empty password. `app.env` is `development`.
Before deploying anywhere real, change these and set `app.env` to `production`.
