# Pinakle migration (Ubuntu 18.04 / PHP 7.2 / MySQL 5.7 → this server)

## What’s here

| Path | Role |
|------|------|
| `site/` | Public website + kitchen forms |
| `site/Admin/` | Admin system |
| `site/customers/` | Customer login portal |
| `site/kilwee/` | Kilwee CRM (same DB) |

Old dump: `/srv/www/systems/old databases/pinakle_orders202610241728.sql` (zipped).

## Current test setup (no host sudo)

Because host MySQL root needs `sudo`, the DB was imported into an LXD container and proxied:

- Container: `pinakle-mysql` (10.126.0.10)
- Host proxy: `127.0.0.1:3307` → container `:3306`
- App configs use `127.0.0.1` port **3307**
- Temporary PHP server: `http://192.168.1.177:8088/`

```bash
# DB status
lxc list pinakle-mysql
mysql -h 127.0.0.1 -P 3307 -u pinakle_app -p'Pinakle26@' pinakle_orders -e 'SHOW TABLES'

# PHP smoke server (if not running)
php -S 0.0.0.0:8088 -t /srv/www/systems/pinakle/site
```

- Website: http://192.168.1.177:8088/
- Admin: http://192.168.1.177:8088/Admin/
- Customers: http://192.168.1.177:8088/customers/

## Permanent host setup (needs one sudo)

Imports into the server’s MySQL 8.4, enables Apache vhost, sets `www-data` write perms, switches app port to **3306**:

```bash
sudo bash /srv/www/systems/pinakle/deploy/setup.sh
```

Then open via Apache (`pinakle.local` / IP) instead of :8088.

Optional: stop the LXD DB after host import is verified:

```bash
lxc stop pinakle-mysql
# or: lxc delete pinakle-mysql --force
```

## Notes

- App code already targets modern PHP (mysqli, password_hash, PHPMailer 7, Dompdf 3). All 269 non-vendor PHP files lint clean on PHP 8.5.
- Dump source: MySQL 5.7.42 / PHP 7.2 (Ubuntu 18.04). Imported cleanly into MySQL 8.4 (45 tables).
