# cPanel installation without terminal access

This package is built for a PHP 8.2+ cPanel account with PDO MySQL, OpenSSL, Mbstring, XML, Curl, Fileinfo and Zip extensions enabled. It contains the Laravel vendor dependencies and compiled frontend assets, so Composer and Node.js are not needed on the host. The SQL file contains the empty application schema, migration history, and default inactive fee records; it contains no local accounts, payment credentials, or development data.

## 1. Create the database

1. In cPanel, open **MySQL Database Wizard**. Create a database and a database user with a strong unique password.
2. Grant that user **All Privileges** for the new database.
3. Open **phpMyAdmin**, select the new database, choose **Import**, select `database/ebiacada-cpanel.sql` from the package, and start the import.

The SQL import should report success and create the application tables. If phpMyAdmin reports an upload size limit, use cPanel's MultiPHP INI Editor to raise `upload_max_filesize` and `post_max_size`, or ask the host to import this SQL file.

## 2. Upload private application files

1. In cPanel **File Manager**, enable **Show Hidden Files** and create a directory beside `public_html`, for example `~/ebi-portal`.
2. Upload the package ZIP and use **Extract** into `~/ebi-portal`. Do not extract the private project into `public_html`.
3. Copy the contents of the package's `public` directory into the domain document root (usually `public_html`). If the domain has its own document root, use that folder instead.
4. Edit the document root's `index.php`: change `../vendor/autoload.php` to `../ebi-portal/vendor/autoload.php`, and change `../bootstrap/app.php` to `../ebi-portal/bootstrap/app.php`. If you used a different private folder name or nesting, adjust these two paths to match.
5. Copy `public/.htaccess` to the document root if it was not copied with the other hidden files. Confirm the host uses Apache/LiteSpeed and that Rewrite is enabled.

Never copy the private project's `.env`, `vendor`, `storage`, or SQL file into the public document root. Keep application code and private uploads outside the web root.

## 3. Configure the app

1. In File Manager, copy `.env.production.example` to `.env` in `~/ebi-portal` and edit it. Set:

   - `APP_URL` to the final HTTPS portal URL.
   - `DB_HOST` to the host value supplied by cPanel (often `localhost`).
   - `DB_DATABASE`, `DB_USERNAME`, and `DB_PASSWORD` to the full cPanel-prefixed names and password.
   - `APP_KEY` to a fresh Laravel key. On a trusted local computer with PHP, run `php -r "echo 'base64:'.base64_encode(random_bytes(32));"` and paste the result without changing it afterwards. This command runs locally, not on cPanel.
   - `EBIACADA_SYNC_SECRET` to a separate, random 64-character hexadecimal secret.
   - Keep `APP_ENV=production`, `APP_DEBUG=false`, and `SESSION_SECURE_COOKIE=true`.
2. Set `FILESYSTEM_DISK=private`, `SESSION_DRIVER=file`, `CACHE_STORE=file`, and `QUEUE_CONNECTION=sync`. These settings avoid requiring background workers and keep private student uploads outside the public folder.
3. In cPanel, select PHP 8.2 or newer for the domain, enable the required extensions, and enable SSL/HTTPS.
4. Set `storage` and `bootstrap/cache` writable by PHP using the hosting provider's recommended permissions (usually 755 directories, occasionally 775). Do not use 777.

## 4. Create the first administrator

1. Visit `/register` and create the first account using an institution-controlled email address.
2. In phpMyAdmin, open the imported database and the `users` table. Edit only your new account row: set `portal_role` to `admin`, `is_active` to `1`, and save. Do not alter its password field.
3. Sign in at `/login`. Immediately confirm the account can open the admin portal. Regular public registration remains student/parent; never share the admin account.

## 5. Final checks

- Visit the homepage and sign in; confirm CSS and JavaScript load.
- Confirm HTTPS, login, registration, and admin navigation work.
- Verify a request for `/.env`, `/vendor/autoload.php`, `/storage/logs/laravel.log`, and the SQL dump returns 403 or 404.
- Upload a test student document and verify it can only be retrieved by an authorized signed-in account.
- Configure payment gateway credentials only after testing the provider's sandbox callbacks and webhook signatures.
- Delete the uploaded package ZIP from the account after extracting it. Keep a protected backup of the SQL dump outside the web root.

If the hosting account cannot set the domain document root to the Laravel `public` directory, this layout uses a tiny `public/index.php` path edit to keep application code and uploads outside `public_html`. Confirm `.htaccess` rewrite support and never make the private project directory web-accessible.
