# Deploying to adepafie.com (cPanel)

## 1. Upload files

Upload **all** files and folders to the document root of `adepafie.com` (usually `public_html/`).

The folder should contain `index.php`, `admin/`, `includes/`, `assets/`, etc.

## 2. Create the MySQL database (cPanel)

1. **MySQL® Databases** → create database (e.g. `imscopyc_mis_classwork`)
2. Create a MySQL user and add it to the database with **ALL PRIVILEGES**
3. Open **phpMyAdmin** → select the database → **Import** → choose `scripts/setup_mysql.sql`

Or paste and run the SQL from `scripts/setup_mysql.sql` in the SQL tab.

## 3. Update `includes/config.php`

Set your live database details (from cPanel):

```php
define('DB_HOST', 'localhost');
define('DB_NAME', 'your_cpanel_db_name');
define('DB_USER', 'your_cpanel_db_user');
define('DB_PASS', 'your_db_password');
define('SITE_URL', 'https://adepafie.com');
define('ADMIN_PASSWORD', 'choose-a-strong-password');
```

## 4. PHP version

In cPanel → **MultiPHP Manager** (or **Select PHP Version**):

- Set `adepafie.com` to **PHP 8.0** or **8.1** (minimum 7.4)

## 5. Run the health check

Open: **https://adepafie.com/health.php**

- All items should be green
- If database fails: check names/password in `config.php` and that SQL was imported
- **Delete `health.php`** after a successful deploy

## 6. URLs

| Page | URL |
|------|-----|
| Student landing | https://adepafie.com/ |
| Admin | https://adepafie.com/admin/ |

## Common causes of HTTP 500

| Cause | Fix |
|-------|-----|
| Database not created / wrong password | Step 2–3, then health.php |
| PHP 7.3 or older | Set PHP 8.0+ in cPanel |
| Tables missing | Import `setup_mysql.sql` (app also auto-creates tables on first visit) |
| `pdo_mysql` disabled | Enable in Select PHP Version → Extensions |

## Local vs live

- **Local (AMPPS):** change `DB_*` back to local values and `SITE_URL` to `''` or `http://localhost/assessment`
