# 🔧 Troubleshooting 500 Error

## Current Issue
500 Internal Server Error aa raha hai `api.php` par.

## Possible Causes

### 1. PHP Syntax Error
- Check karein ki koi syntax error to nahi
- PHP version compatibility

### 2. Missing Files
- `config.php` missing
- `utils.php` missing

### 3. Function Not Found
- `fetchAllCharities()` not found
- `paginateCharities()` not found

### 4. Memory/Execution Issues
- PHP memory limit
- Execution timeout

## Quick Fixes

### Option 1: Use Simple API
Temporary ke liye `api_simple.php` use karein:
```
Rename: api.php → api_old.php
Rename: api_simple.php → api.php
```

### Option 2: Check Server Logs
Server error logs check karein:
```bash
# Apache
tail -f /var/log/apache2/error.log

# Nginx
tail -f /var/log/nginx/error.log

# cPanel
Check error_log file in public_html
```

### Option 3: Enable Error Display (Temporary)
`api.php` mein top par add karein:
```php
ini_set('display_errors', 1);
error_reporting(E_ALL);
```

**Note:** Production mein remove kar dein!

## Test Steps

1. **Basic Test:**
   ```
   https://mcp.illumemedia.app/api.php?action=test
   ```

2. **Check Files Exist:**
   - `config.php` - Must exist
   - `utils.php` - Must exist
   - `api.php` - Must exist

3. **Check Permissions:**
   ```bash
   chmod 644 *.php
   ```

4. **Check PHP Version:**
   ```bash
   php -v
   ```
   Should be PHP 7.4+ or 8.0+

## Alternative: Use api_simple.php

`api_simple.php` ek minimal version hai jo definitely kaam karega. Agar `api.php` mein issue ho to:

1. `api.php` ko backup karein
2. `api_simple.php` ko `api.php` rename karein
3. Test karein

## Contact Server Admin

Agar sab kuch theek lag raha hai to:
- Server error logs check karein
- PHP error logs check karein
- Server configuration check karein

---

**Quick Test:**
```
https://mcp.illumemedia.app/api_simple.php?action=test
```

Agar yeh kaam kare to `api.php` mein issue hai.

