# EdumacFlo School Management System — Quick Deployment Guide

Welcome to **EdumacFlo**! This deployment guide walks you through setting up your school management portal on a local server (WAMP, XAMPP) or live hosting (cPanel, Plesk, Linux VPS).

---

## 1. System Prerequisites

- **Web Server**: Apache / LiteSpeed / Nginx with `mod_rewrite` enabled
- **PHP Version**: PHP 7.4 to PHP 8.2+
- **PHP Extensions**:
  - `mysqli` (MySQL Database driver)
  - `pdo_mysql`
  - `zip` (For compressed backup generation and package extraction)
  - `gd` or `imagick` (For image resizing and avatar uploads)
  - `mbstring` (For Unicode text support)
- **Database**: MySQL 5.7+ or MariaDB 10.3+

---

## 2. ⚡ Option A: 1-Click Automated Web Installer (Recommended)

EdumacFlo comes with a graphical web installer that automatically sets up databases, imports schemas, configures administrators, and generates security configuration files.

1. **Upload & Extract**: Extract `edumacflo-v2-saas-installer.zip` into your server webroot (`public_html/`).
2. **Launch Setup Wizard**: Open your browser and navigate to:
   ```
   https://yourdomain.com/install/
   ```
   *(Or simply open `https://yourdomain.com/` — unconfigured setups will automatically redirect you to `/install/`)*.
3. **Follow the 5-Step Wizard**:
   - **Step 1**: Automatic PHP runtime & write permissions check.
   - **Step 2**: Select **Multi-Tenant SaaS Mode** or **Single-Tenant Mode** and enter your MySQL database credentials.
   - **Step 3**: Configure your Master Super-Admin and initial school profile.
   - **Step 4**: One-click automated database schema import and configuration generation.
   - **Step 5**: Done! The installer automatically locks itself for security.

For a full step-by-step visual tutorial on cPanel hosting, see [deploy/CPANEL_INSTALL_GUIDE.md](file:///deploy/CPANEL_INSTALL_GUIDE.md).

---

## 3. 🛠️ Option B: Manual Fast 3-Step Installation

### Step 2: Import the Database
1. Open **phpMyAdmin** (or your MySQL database management tool).
2. Create a new database with `utf8mb4_unicode_ci` collation (e.g., named `edumacflo`).
3. Click the **Import** tab.
4. Choose the file: `database/edumacflo.sql`.
5. Click **Import** (or **Go**). The complete schema and seed configurations will be created.

### Step 3: Configure Database Connection
1. In the project root directory, locate `db_config.sample.php`.
2. Copy or rename it to `db_config.php`.
3. Open `db_config.php` in a text editor and enter your MySQL database credentials:

```php
return [
    'server'   => 'localhost',
    'username' => 'your_db_username',
    'password' => 'your_db_password',
    'dbname'   => 'edumacflo',
];
```

4. Save the file. Your database is now connected!

> **Security Tip**: For enhanced live production security, you can place `db_config.php` one directory **above** your public webroot (e.g. `/home/username/db_config.php`). The system will automatically detect and load it from there.

---

## 3. Default Super Administrator Login

Navigate to your website's login page (e.g., `http://localhost/your_project/login.php` or `https://yourschool.com/login.php`):

- **Login URL**: `/login.php`
- **Username**: `admin`
- **Password**: `admin123`
- **Role**: Super Administrator (Full Access)

---

## 4. Post-Installation Checklist

Once logged in as Super Administrator:
1. **Change Default Password**: Navigate to **Staff Profile / My Account** and immediately change the default `admin123` password.
2. **Update School Information**: Navigate to **Settings -> School Profile** to set your school name, address, motto, contact email, and school logo.
3. **Configure Academic Session & Term**: Verify your current academic session and term in the administration settings.
4. **Setup Classes & Teachers**: Add or modify classes, assign class teachers, and register subjects tailored to your school's curriculum.

---

## 5. Folder Permissions (Linux / cPanel)

Ensure the following directories have write permissions (`0755` or `0775`):
- `uploads/` (and subdirectories: `uploads/students/`, `uploads/staff/`, `uploads/school/`)
- `portal/backups/`

---

## Need Support?
For assistance or customizations, contact your EdumacFlo technical representative.
