DEPLOYMENT INSTRUCTIONS (cPanel / Hostinger / etc.)
=====================================================

1. PHP VERSION
--------------
Ensure your hosting is running PHP 8.2 or higher.
Go to cPanel -> "MultiPHP Manager" or "Select PHP Version" and choose PHP 8.2.

2. DATABASE CONFIGURATION
-------------------------
You need to create a database in cPanel first.
1. Go to "MySQL® Databases".
2. Create a new database (e.g., `user_profile`).
3. Create a new user and password.
4. Add user to database with ALL PRIVILEGES.

Then, open `app/Config/Constants.php` and update:
   define('DB_HOST', 'localhost');
   define('DB_NAME', 'your_cpanel_db_name');
   define('DB_USER', 'your_cpanel_db_user');
   define('DB_PASS', 'your_cpanel_db_password');

3. FOLDER STRUCTURE & UPLOAD
----------------------------
There are two ways to upload. Choose ONE method.

METHOD A: SECURE (RECOMMENDED)
------------------------------
This method keeps your `app` code outside the public folder for better security.

/home/youruser/
├── app/                <-- Upload the entire 'app' folder here
└── public_html/        <-- Upload the CONTENTS of 'public' folder here
    ├── index.php
    ├── .htaccess
    ├── assets/
    └── uploads/

* No code changes needed for this method.
* Your domain points to `public_html`.

METHOD B: SIMPLE (EVERYTHING IN PUBLIC_HTML)
--------------------------------------------
If you cannot access the folder outside `public_html`, upload everything inside.

/home/youruser/public_html/
├── app/                <-- Upload 'app' folder here
├── index.php           <-- From 'public' folder
├── .htaccess           <-- From 'public' folder
├── assets/            <-- From 'public' folder
└── uploads/           <-- From 'public' folder

[IMPORTANT] If you use Method B, you MUST edit `index.php`:
Find this line (around line 26):
   define('ROOT_PATH', dirname(__DIR__));

Change it to:
   define('ROOT_PATH', __DIR__);

4. PERMISSIONS
--------------
Ensure the following folders are writable (755 or 777):
- public_html/uploads/
- public_html/assets/

5. SUBDOMAINS / SUBFOLDERS
--------------------------
This system automtically detects the URL.
- Main Domain: `domain.com` -> Works.
- Subdomain: `app.domain.com` -> Works.
- Subfolder: `domain.com/myapp` -> Works (Upload files into `public_html/myapp`).

6. TROUBLESHOOTING
------------------
- If images break, check `app/Config/Constants.php` ensuring `UPLOAD_PATH` is correct.
- If you see "404 Not Found", ensure `.htaccess` was uploaded (it is a hidden file).
- If you see "500 Error", check `error_log` file in the folder.
