# cPanel deployment

## Requirements

- PHP 8.3: BCMath, Ctype, cURL, DOM, Fileinfo, Mbstring, OpenSSL, PDO MySQL, Tokenizer and XML.
- MySQL 8+ or MariaDB 10.6+, Composer 2, and a valid HTTPS certificate.

## Recommended layout

Keep Laravel outside the public web root. Set the domain Document Root to `/home/CPANEL_USER/careflow/public`:

```text
/home/CPANEL_USER/careflow/       application
/home/CPANEL_USER/public_html/    unrelated/default web root
```

If the host will not allow a custom document root, copy the contents of `public/` to `public_html/`. In `public_html/index.php`, change both `__DIR__.'/../` references to `__DIR__.'/../careflow/`.

## Install

1. Upload this project to `/home/CPANEL_USER/careflow`.
2. Create a MySQL database and user in cPanel and grant that user all privileges.
3. Run in cPanel Terminal:

```bash
cd /home/CPANEL_USER/careflow
cp .env.example .env
composer install --no-dev --optimize-autoloader
php artisan key:generate
```

4. Edit `.env`; set `APP_URL`, timezone, and cPanel-prefixed database credentials. Leave `APP_DEBUG=false`.
5. Finish installation:

```bash
php artisan migrate --force
php artisan db:seed --force
php artisan storage:link
php artisan optimize
chmod -R 775 storage bootstrap/cache
```

6. Sign in using `admin@example.com` / `ChangeMe!2026`, then change that password immediately.
7. In **Hospital settings**, upload the logo, rename the hospital and configure SMTP.

## Operations and safety

Use HTTPS only. Enable MFA for cPanel/SSH. Create separate named EMR users. Back up MySQL and `storage/app` to encrypted off-server storage and test restoration regularly.

This is an EMR foundation, not a claim of HIPAA, GDPR, NDPR, or other certification. Before clinical use, commission security and privacy reviews and add jurisdiction-specific consent, retention, terminology, immutable audit export, breach, and disaster-recovery procedures.
