Sindbad~EG File Manager

Current Path : /home/copmadinaarea/thecopmadinaarea.org/portal/docs/
Upload File :
Current File : /home/copmadinaarea/thecopmadinaarea.org/portal/docs/PHP_SETTINGS_GUIDE.md

# PHP Settings Configuration Guide

## Issue
The `.htaccess` file originally contained `php_value` directives that cause **500 Internal Server Error** on many shared hosting providers.

## Solution Applied
✅ PHP settings removed from `.htaccess`  
✅ Settings now configured via hosting control panel

---

## How to Configure PHP Settings (Shared Hosting)

### Method 1: cPanel (Most Common)

1. **Login to cPanel**
2. **Find "Select PHP Version" or "MultiPHP INI Editor"**
3. **Set these values:**
   - `upload_max_filesize` → **10M** (or higher)
   - `post_max_size` → **10M** (or higher)
   - `max_execution_time` → **300** seconds
   - `max_input_time` → **300** seconds
   - `memory_limit` → **256M** (recommended)

### Method 2: php.ini File

If you have access to create/edit `php.ini` in your app root:

```ini
; PHP Settings for Church Membership System
upload_max_filesize = 10M
post_max_size = 10M
max_execution_time = 300
max_input_time = 300
memory_limit = 256M
```

Save as `php.ini` in your application root folder.

### Method 3: .user.ini File

Some hosts use `.user.ini` instead:

```ini
upload_max_filesize = 10M
post_max_size = 10M
max_execution_time = 300
max_input_time = 300
memory_limit = 256M
```

Save as `.user.ini` in your application root folder.

---

## Verify Settings Applied

**Option 1: Create phpinfo.php**
```php
<?php phpinfo(); ?>
```

Upload, visit in browser, search for your settings, then DELETE the file.

**Option 2: Use server_check.php**

Run the diagnostic tool - Section 8 shows current PHP settings.

---

## Recommended Settings for Production

| Setting | Minimum | Recommended | Purpose |
|---------|---------|-------------|---------|
| `upload_max_filesize` | 5M | 10M | Member photo uploads |
| `post_max_size` | 8M | 10M | Form submissions |
| `max_execution_time` | 120 | 300 | Report generation, exports |
| `max_input_time` | 120 | 300 | Bulk uploads |
| `memory_limit` | 128M | 256M | PDF generation, Excel exports |

---

## For VPS/Dedicated Servers

If you have full server access, you CAN use `.htaccess` php_value directives.

**Uncomment these lines in `.htaccess`:**
```apache
# Remove the # from these lines:
php_value upload_max_filesize 10M
php_value post_max_size 10M
php_value max_execution_time 300
php_value max_input_time 300
```

**Or edit main php.ini:**
```bash
# Location varies by system:
# Ubuntu/Debian: /etc/php/7.4/apache2/php.ini
# CentOS: /etc/php.ini

sudo nano /etc/php/7.4/apache2/php.ini
# Make changes, save
sudo service apache2 restart
```

---

## Troubleshooting

### "File too large" error when uploading
- Increase `upload_max_filesize`
- Increase `post_max_size` (should be larger than upload_max_filesize)

### "Maximum execution time exceeded"
- Increase `max_execution_time`
- For bulk operations, may need 600+ seconds

### "Allowed memory size exhausted"
- Increase `memory_limit`
- 256M is good, 512M for heavy reports

### Changes not taking effect
- Wait 5-10 minutes (some hosts have delay)
- Clear browser cache
- Restart PHP-FPM (if you have access)
- Check you edited the correct php.ini file

---

## Platform-Specific Instructions

### Hostinger
Settings → Advanced → PHP Configuration → PHP Options

### Bluehost
Advanced → MultiPHP INI Editor → Select domain → Edit settings

### SiteGround
Site Tools → Devs → PHP Manager → php.ini Editor

### GoDaddy
Plesk → PHP Settings → Upload size, Execution time

### NameCheap
cPanel → Select PHP Version → Options tab

### InMotion
cPanel → Software → Select PHP Version → Switch to Options

---

## Current Application Settings

✅ `.htaccess` - PHP settings removed (hosting-friendly)  
✅ File upload limit set in code: 5MB (can be increased)  
✅ Session timeout: 1 hour  
✅ Timezone: UTC (configurable in settings)

---

**Status:** PHP settings configured via hosting control panel  
**Deployment-ready:** Yes - works on all shared hosting

Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists