# cPanel automated deployment – JobPortal

## Fast path (no SSH)

1. **Create MySQL database** in cPanel → MySQL Databases  
   - Create DB + user, grant ALL privileges  
   - Copy the full names (cPanel often prefixes them)

2. **Upload** `jobportal-deploy.zip` via File Manager and extract

3. **Document root** must be the `public` folder  
   - Subdomain: set document root to `.../jobportal/public`  
   - Or move contents of `public/` into `public_html` and keep the rest of the app **one level above** `public_html`

4. **Permissions** – ensure these are writable (755/775):  
   - `storage/`  
   - project root (so installer can write `.env`)

5. **Run installer** in the browser:  
   `https://your-domain.com/install.php`  
   - Fill App URL, DB credentials, admin email/password  
   - Click **Install JobPortal**

6. **Delete** `public/install.php` immediately after success

7. **Login** at `/login` with the admin account you created

## Folder layout examples

### Subdomain (recommended)
```
/home/USER/jobportal/          ← full project
/home/USER/jobportal/public/   ← document root for jobs.example.com
```

### Main domain
```
/home/USER/app/                ← full project (private)
/home/USER/public_html/        ← only files from public/ (index.php, assets, .htaccess)
```
Update paths in `public/index.php` if you split folders (default structure expects project root one level above `public`).

## After install

- Change admin password  
- Set up cron (cPanel → Cron Jobs) if available:
  ```
  0 1 * * * php /home/USER/jobportal/cron/expire_jobs.php
  0 2 * * * php /home/USER/jobportal/cron/expire_premium.php
  ```
- Premium prices are in **RWF** (edit in Admin → Packages)

## Troubleshooting

| Issue | Fix |
|-------|-----|
| Installer requirements FAIL on writable | chmod 775 storage and parent folder |
| DB connection error | Use full cPanel DB name/user; host usually `localhost` |
| 404 on /login | Document root is not `public`; enable RewriteEngine |
| 500 error | PHP 8.2+; check error logs in cPanel |
| Blank page | Enable display_errors temporarily or check `storage/logs` |

## Security

- Never leave `install.php` on a live site  
- `storage/install.lock` blocks re-install  
- Set `APP_DEBUG=false` (installer does this)  
- Use HTTPS in App URL  
