PMSS API CONNECTION SETUP
=========================

Upload the full api folder to:
/home/purbomod/admin.purbomodukhaliss.edu.bd/api/

Your earlier error:
{"error":"Database not configured"}

means PHP cannot read DB_HOST, DB_USER, DB_PASS, DB_NAME from your hosting environment.
This package now supports TWO connection methods.


METHOD 1: db.local.php fallback (recommended for cPanel)
--------------------------------------------------------
1. In the uploaded api folder, copy:
   db.local.example.php

2. Rename the copy to:
   db.local.php

3. Edit api/db.local.php with your real unified database credentials:

   DB_HOST = localhost
   DB_USER = your cPanel MySQL username
   DB_PASS = your cPanel MySQL password
   DB_NAME = your unified database name

Example:
return [
    'DB_HOST' => 'localhost',
    'DB_USER' => 'purbomod_pmss',
    'DB_PASS' => 'YOUR_REAL_PASSWORD',
    'DB_NAME' => 'purbomod_pmss',
];

Do not share db.local.php publicly.


METHOD 2: .htaccess environment variables
-----------------------------------------
If your hosting supports Apache SetEnv, create/edit api/.htaccess:

SetEnv DB_HOST localhost
SetEnv DB_USER purbomod_pmss
SetEnv DB_PASS YOUR_REAL_PASSWORD
SetEnv DB_NAME purbomod_pmss


TEST AFTER UPLOAD
-----------------
Open this URL after setting credentials:
https://admin.purbomodukhaliss.edu.bd/api/test-connection.php

Expected success:
{
  "success": true,
  "message": "API database connection is working."
}

Then test login again.


IMPORTANT
---------
- Upload ALL files and folders from this api package.
- If you deleted old files, do not upload only changed files — upload the whole api folder.
- Make sure your database already contains the unified SQL tables.
- If test-connection.php says table missing, import the unified SQL again.
