================================
QUICK FIX COMMANDS FOR LIVE SERVER
================================

1. SSH/TERMINAL COMMANDS (Copy & Paste All)
--------------------------------------------

cd ~/public_html
chmod 777 application/cache
chmod 755 application/logs
chmod 755 uploads/attachments
chmod 644 .htaccess
chmod 644 index.php
ls -la application/ | grep -E 'cache|logs'


2. CPANEL FILE MANAGER PERMISSIONS
------------------------------------

Right-click on these folders and set permissions:

application/cache/      -> 777 (rwxrwxrwx)
application/logs/       -> 755 (rwxr-xr-x)
uploads/attachments/    -> 755 (rwxr-xr-x)


3. FILES TO UPLOAD
-------------------

Upload to root directory:
✓ diagnose.php
✓ test_db_simple.php
✓ index.php (updated version)
✓ .htaccess (IMPORTANT: Enable "Show hidden files" in FTP!)


4. URLS TO TEST (In Order)
----------------------------

Step 1: https://brandwave.aurigaconsulting.co.in/diagnose.php
   → Will show ALL issues

Step 2: https://brandwave.aurigaconsulting.co.in/test_db_simple.php
   → Tests database only

Step 3: https://brandwave.aurigaconsulting.co.in/auth/login
   → Your login page (should work now)


5. IF DATABASE CONNECTION FAILS
---------------------------------

Option A: Run in phpMyAdmin
   - Open fix_database.sql
   - Copy SQL commands
   - Execute in phpMyAdmin

Option B: Contact hosting provider
   - Ask to whitelist your server IP on database server
   - Ask to verify port 3306 is open
   - Verify database credentials


6. AFTER EVERYTHING WORKS
---------------------------

Delete these security risk files:
rm diagnose.php
rm test_db_simple.php
rm test_connection.php
rm php_error.log

Comment out error catcher in index.php:
// require_once __DIR__ . '/error_catcher.php';


7. COMMON ISSUES & FIXES
--------------------------

Issue: "500 Internal Server Error"
Fix: chmod 777 application/cache

Issue: "404 Not Found on all routes"
Fix: Re-upload .htaccess file

Issue: "Database connection failed"
Fix: Check firewall, verify credentials

Issue: "Permission denied"
Fix: chmod 777 application/cache application/logs

Issue: "Portal not found"
Fix: Run fix_database.sql commands


8. VERIFICATION CHECKLIST
---------------------------

□ Uploaded diagnose.php
□ Uploaded index.php (updated)
□ Uploaded .htaccess (verify it exists!)
□ Set application/cache to 777
□ Set application/logs to 755
□ Ran diagnose.php - all green
□ Can access /auth/login
□ Can login successfully
□ Deleted diagnostic files


9. CONTACT SUPPORT IF NEEDED
------------------------------

If still not working after all steps:
1. Screenshot the diagnose.php output
2. Check server error logs in cPanel
3. Send error messages to hosting support
4. Verify PHP version (needs 7.4 or 8.0)


10. FINAL TEST
---------------

Visit: https://brandwave.aurigaconsulting.co.in/auth/login

Should see: Login page loads
Should be able to: Login with credentials
Should NOT see: 500 error or blank page

================================
MOST COMMON FIX: chmod 777 application/cache
================================
