# Deploy GIC Dashboard on cPanel

This app requires PHP 8.2+, MySQL 8.0+ (or a compatible server), and HTTPS. It must never be served from the project root. Keep the project and .env outside the web document root. See the CodeIgniter deployment guide: https://codeigniter.com/user_guide/installation/deployment.html

## 1. Prepare cPanel

1. Create a dedicated domain or subdomain and enable its SSL certificate.
2. Select PHP 8.2 or newer. Enable intl, mbstring, mysqli, and fileinfo. Allow uploads of at least 10 MiB; set upload_max_filesize and post_max_size above that limit.
3. Create a MySQL database and a dedicated database user in cPanel. Grant the user access only to this database. Record cPanel's exact prefixed database and user names.
4. Back up any existing site and database at the target domain before changing the document root.

## 2. Upload the application

Preferred layout:

    /home/CPANEL_USER/gic-dashboard/           project root; includes app, vendor, writable, .env
    /home/CPANEL_USER/gic-dashboard/public/    domain document root

Upload and extract the code archive into the project root. Set the domain's Document Root to the public directory. If cPanel cannot set that path, use a dedicated subdomain with public_html for only this app: keep app, vendor, writable, .env, and spark in /home/CPANEL_USER/gic-dashboard, copy only the CONTENTS of public into the subdomain document root, and change its index.php Paths.php require line to:

    require dirname(__DIR__) . '/gic-dashboard/app/Config/Paths.php';

Do not place app, vendor, writable, .env, database exports, or the archive in public_html. Keep public/.htaccess with index.php and assets.

## 3. Configure production

Copy env.production.example to .env in the project root. Replace the domain and database placeholders. The base URL must begin with https:// and end with a slash. Keep CI_ENVIRONMENT set to production. Never use the local root database connection or an empty database password on cPanel.

Make writable/cache, writable/logs, writable/session, and writable/uploads writable by the cPanel PHP user. Use the minimum permissions that work; do not use world-writable permissions. Keep uploads outside the document root.

## 4. Database

For a fresh site, run php spark migrate once from the project root, then php spark gic:admin with a unique administrator email and strong password. If cPanel has no Terminal/SSH, import database/schema.sql into an empty database with phpMyAdmin and pre-create the initial admin through a controlled local setup and database import.

To carry over local records and accounts, export the entire local gic_dashboard database and import that dump into the empty cPanel database. Do not run migrations or import schema.sql after a full database import. Change the local development administrator password before exposing the imported accounts online.

If local uploads must move too, copy their files from writable/uploads into the production writable/uploads directory. Database rows without their matching uploaded files cannot be downloaded.

## 5. Verify before use

1. Open https://dashboard.globalinvestmentconvention.com/login and sign in.
2. Confirm the dashboard, conference-to-B2B prefill, approval queue, reports/CSV, and a private attachment download.
3. Confirm HTTP redirects to HTTPS and that .env, app, vendor, writable, and database dumps are not reachable through public URLs.
4. Keep a database and uploads backup schedule. Test restoring a backup.
