# Production Notes

## Runtime

- Recommended PHP version: PHP 8.1 or newer.
- Recommended MySQL version: MySQL 8.0 or newer, or MariaDB 10.6 or newer.
- Required PHP extensions:
  - mysqli
  - mbstring recommended
  - json
  - openssl

## Security

- Enable HTTPS before production use.
- Disable `display_errors` in production.
- Keep `log_errors` enabled and send errors to a protected server log.
- Change the default admin password immediately.
- Use strong passwords for admin, viewer, and cameraman accounts.
- Keep database credentials outside public version control.
- Restrict database user permissions to the application database only.

## Server Protection

- Protect the `includes/` folder from direct public browsing where your server supports it.
- Protect the `logs/` folder from public browsing.
- Ensure `logs/activity.log` is writable by the web server but not publicly downloadable.
- Do not expose `.sql` files publicly on production if your hosting allows direct download.

## Database

- Back up the database before every migration.
- Import `schema.sql` first for fresh installs.
- Import migrations in order after the schema.
- Review migrations before running them on an existing production database.
- Never run destructive SQL without a verified backup.

## Timezone

- Server timezone should be set to:

```text
Asia/Karachi
```

- The application default is also `Asia/Karachi`.
- Confirm PHP, MySQL, and server clocks are aligned.

## Operational Safety

- Test login, CRUD modules, schedule actions, resource lookup, reports, calendar, alerts, notifications, and exports after deployment.
- Confirm Started schedules set cameraman Busy and camera Assigned.
- Confirm Completed and Cancelled schedules release cameraman and camera to Available.
- Confirm Camera Issue moves the camera to Maintenance.
- Confirm room availability is based on schedule overlaps, not a stored room status.

## Backups

- Schedule regular database backups.
- Keep at least one recent backup off the web server.
- Test restore procedures before relying on backups.

## Maintenance

- Apply migrations during a quiet operational window.
- Ask users to log out before major upgrades.
- Keep a copy of the current application folder before replacing files.
- After updates, verify `migrations/README.md` and run any new migration files in order.
