# PHP/MySQL cPanel Deployment Guide

## Strong Tower Home Health Services

This folder is the production application. It runs on PHP 8+ with MySQL or MariaDB and does not require React, Node.js, npm, Vite, TypeScript, Express, or `db.json`.

### Requirements

- PHP 8.0+
- MySQL 5.7+ or MariaDB 10.3+
- PHP extensions: `pdo_mysql`, `session`, `openssl`, `filter`, `fileinfo`, `curl` if optional Gemini drafts are enabled
- Apache with `.htaccess` enabled

### Install

1. Upload the contents of this folder to the cPanel document root or add-on domain root.
2. Create a MySQL database and database user in cPanel.
3. Import `database.sql` in phpMyAdmin.
4. Edit `config.php` or set environment variables for:
   - `STHHS_DB_HOST`
   - `STHHS_DB_NAME`
   - `STHHS_DB_USER`
   - `STHHS_DB_PASS`
   - `STHHS_BASE_URL`
5. Confirm the base URL is `https://www.compassionatecareusa.com`.

### First Admin

No default admin password is shipped.

Generate a private password hash:

```bash
php -r "echo password_hash('your-private-password', PASSWORD_DEFAULT);"
```

Then insert the first admin in phpMyAdmin:

```sql
INSERT INTO admins (username, password_hash, email, role, active)
VALUES ('admin', 'PASTE_HASH_HERE', 'info@strongtowerhomehealth.com', 'admin', 1);
```

Admin login URL:

`https://www.compassionatecareusa.com/admin/login.php`

### Optional Gemini Drafts

The Blog CMS works without Gemini. To enable draft generation, set `GEMINI_API_KEY` on the server. The key is read only by PHP, never printed into HTML or JavaScript. Generated articles are saved as `Draft` and must be reviewed before publishing.

### Upload Security

Job applications accept verified PDF, DOC, and DOCX files up to 5 MB. Uploaded resumes are blocked from direct web access and are downloaded through authenticated admin-only PHP.

### Production Notes

- Referral links use the configured base URL, for example `https://www.compassionatecareusa.com/?ref=CODE`.
- Referral rewards and eligibility are subject to company review and program terms.
- Forms store submissions in MySQL before attempting email notification.
- `config.php`, `db.php`, SQL files, and upload directories are protected by `.htaccess`.
