# ProjectWorlds Multi-School ERP — Fresh Installation Guide

| | |
|---|---|
| **Version** | v3.8.0-beta |
| **Document Date** | 16-10-2026 |
| **Time to Install** | About 1 hour (shared hosting) · 1–2 hours (aaPanel) · 2 hours (plain VPS) |
| **Terminal Required** | No (shared hosting) / Yes (VPS and aaPanel) |

📖 **Full online docs:** [docs.multischoolerp.com/install](https://docs.multischoolerp.com/install/)

> **Upgrading an existing v3.7.0-beta site?** Do **not** use this guide — follow
> `UPDATE_GUIDE_v3.8.0-beta.md` instead. This guide is for brand-new installs only.

---

## What You Received

The v3.8.0-beta package is **ready to run**. It contains:

| Item | What it is |
|---|---|
| The application folder | The complete system — `vendor/` already built and a **`.env` settings file already included** |
| A `.sql` file | The database, already at 3.8.0-beta: every table, permission, menu item and starter content |
| Your login details | The default super admin login, sent with your purchase |

That means you **do not**:

- run `composer install` or `npm install`
- run migrations or seeders
- install Node.js (PDFs render through Chrome straight from PHP — see [Better-quality PDFs](#optional--better-quality-pdfs-vps-and-aapanel))

You only **upload**, **import the database**, **edit a few lines in `.env`**, and
**add the cron job** (plus, on a VPS, **one queue worker**).

---

## Pick Your Path

| Your hosting | Follow | You will need |
|---|---|---|
| **Shared hosting** with cPanel (also hPanel, Plesk, DirectAdmin) | [Path A — Shared hosting](#path-a--shared-hosting-cpanel) | Just the hosting control panel. No terminal |
| **VPS** with plain Ubuntu, no panel | [Path B — VPS](#path-b--vps-ubuntu--nginx) | SSH access as a sudo user |
| **VPS with aaPanel** | [Path C — aaPanel](#path-c--aapanel) | aaPanel login, plus its Terminal for a few commands |

> **Not sure which hosting you need?** See
> [Which hosting do I need?](https://docs.multischoolerp.com/guide/choose-hosting).
> In short: everything runs on shared hosting except **face recognition** and **IP
> camera attendance**, which need a VPS.

**Every path needs** ([full list](https://docs.multischoolerp.com/install/server-requirements)):

- **PHP 8.3 or 8.4** — not 8.5
- **MySQL 8.0+** or **MariaDB 10.5+**
- PHP extensions: `bcmath ctype curl dom fileinfo gd json mbstring openssl pdo_mysql tokenizer xml zip`
- PHP functions `proc_open` and `symlink` **not disabled**
- A domain (or subdomain) pointed at your server, with SSL
- **Recommended:** `upload_max_filesize` and `post_max_size` of **64M** — Online Courses
  accepts uploads up to 50 MB per file (the bare minimum for everything else is 20M)

---

## What's New for Installers in v3.8.0-beta

- **`.env` now comes inside the package.** You edit it — you no longer copy
  `.env.install.example` first. (If your package has no `.env` for any reason, copy
  `.env.install.example` to `.env` and continue — never `.env.example`.)
- **Still one cron job.** The new nightly and hourly jobs in this release (alumni
  sync, hourly fee reminders, Canteen and Online Courses payment checks) all run
  through the same `schedule:run` cron. No extra cron entries.
- **Canteen & Cashless Campus** and **Online Courses** are paid add-ons and stay off
  until you add them to a plan in **Superadmin → Plans**.
- **Automatic fee reminders stay off** until each school switches them on in
  **Fees & Dues**.
- **Roles are per school.** A school's changes in Roles & Permissions affect only that
  school (`SCHOOL_ROLE_OVERRIDES=true`, the default).

See `CHANGELOG-v3.8.0-beta.md` for everything in this release.

---

## The `.env` Edits (all paths)

`.env` is a plain text file in the main folder (next to `artisan`). Its name starts
with a dot, so **file managers hide it** — turn on "show hidden files".

### Lines you must change

| Line | What to put | Example |
|---|---|---|
| `APP_URL` | Your real address — with `https://`, **no** trailing slash | `https://erp.stmarys.edu.in` |
| `DB_DATABASE` | The database name you create | `u123456_school` |
| `DB_USERNAME` | The database user you create | `u123456_admin` |
| `DB_PASSWORD` | That user's password | — |

Leave `DB_HOST=127.0.0.1` and `DB_PORT=3306` unless your host tells you otherwise
(some shared hosts use `localhost`).

> ⚠️ **`APP_URL` must match exactly** how people open the site. If it is wrong,
> payment gateway callbacks, WhatsApp links and uploaded images break.

### Lines to check (they should already be correct)

These are safety settings. Make sure each one reads exactly like this:

| Line | Must be | Why |
|---|---|---|
| `APP_ENV` | `production` | Turns on production behaviour |
| `APP_DEBUG` | `false` | `true` shows your database password to anyone who triggers an error |
| `DEMO_MODE` | `false` (or the line absent) | `true` puts one-click demo login buttons on your login page |
| `QUEUE_CONNECTION` | `database` | Background work is stored and processed by the worker — see [The Queue Worker](#the-queue-worker-supervisor) |
| `QUEUE_WORKER_MODE` | `scheduler` | Leave it. Change to `supervisor` **only** after you have set up Supervisor (VPS / aaPanel) |

### Optional lines

| Line | Default | Change it if |
|---|---|---|
| `APP_NAME` | `"Multi School ERP"` | You want your own name in the browser tab and emails |
| `APP_TIMEZONE` | `Asia/Kolkata` | Your schools are **outside India** — e.g. `Africa/Nairobi`, `Asia/Dubai`. Set it **before** schools start using the system |
| `MAIL_*` | — | Better: set email in the panel after login — [Setting up email](https://docs.multischoolerp.com/configure/email) |
| `BILLING_FLEXIBLE_PLANS_ENABLED` | `false` | You sell per-student / tiered / hybrid plans — see [Flexible pricing](#optional--flexible-pricing) |
| `PDF_CHROME_PATH` | empty | VPS / aaPanel with Chrome installed — see [Better-quality PDFs](#optional--better-quality-pdfs-vps-and-aapanel) |

Nothing else in `.env` needs touching. The file arrives with no cached settings, so
your edits take effect immediately.

---

## Path A — Shared Hosting (cPanel)

Menu names below are cPanel's. hPanel, Plesk and DirectAdmin have the same tools under
similar names. Step-by-step with more detail:
[Installing on shared hosting](https://docs.multischoolerp.com/install/shared-hosting).

### A1 — Set the PHP version

**Select PHP Version** (or **MultiPHP Manager**) → choose **8.3** or **8.4** for your
domain. In the same screen, tick any missing extension from the list above, and under
**Options** set `upload_max_filesize` and `post_max_size` to `64M`.

### A2 — Upload the files

1. **File Manager** → open `public_html` (or your subdomain's folder)
2. Delete any placeholder `index.html` your host put there
3. **Upload** the package `.zip`, then **Extract** it
4. **Settings** (top right) → tick **Show Hidden Files**

Check: inside `public_html` you should now see `artisan`, `app`, `public`, `vendor`,
`.htaccess` and `.env` **directly** — not inside another folder. If they landed in a
subfolder, move everything up one level.

> You do **not** change the document root. The included `.htaccess` sends visitors to
> the `public` folder automatically, and keeps `.env` unreachable from the browser.

### A3 — Create the database and import the `.sql`

1. **MySQL Database Wizard** → create a database, then a user, then tick
   **All Privileges**
2. Write down the **full** names — cPanel adds a prefix, e.g. `u123456_school`
3. **phpMyAdmin** → click your new database → **Import** → choose the supplied `.sql`
   file → **Import**

> The 3.8.0-beta `.sql` is large. If phpMyAdmin times out or says the file is too big,
> use your host's database import tool, or ask your host to import it for you.

### A4 — Edit `.env`

In File Manager, right-click `.env` → **Edit**. Make the
[`.env` edits](#the-env-edits-all-paths) above and **Save**.

### A5 — Add the cron job

**Cron Jobs** → **Common Settings** → **Once Per Minute (\* \* \* \* \*)**, then paste
this into **Command** (replace `CPANELUSER` with your cPanel username, and
`public_html` with your folder if different):

```
cd /home/CPANELUSER/public_html && /usr/local/bin/php artisan schedule:run >> /dev/null 2>&1
```

On shared hosting **this cron job is also your queue worker** — nothing else to set
up. Read [The Cron Job](#the-cron-job) for why it matters and how to check it.

### A6 — Replace the application key

The supplied `APP_KEY` is the same for every buyer. Replace it **today**, before you
enter any gateway or SMS details or print ID cards.

- **cPanel has Terminal** (Advanced → Terminal):
  ```
  cd ~/public_html && php artisan key:generate --force
  ```
- **No terminal:** contact us and we will send a key made for your installation alone.

Why the timing matters: [Replace the Application Key](#replace-the-application-key).

### A7 — Log in

Open your domain. Log in with the details sent with your purchase and **change the
password immediately**. Then do the [Post-Install Checklist](#post-install-checklist).

---

## Path B — VPS (Ubuntu + Nginx)

Written for **Ubuntu 24.04 LTS** (it ships PHP 8.3). Run the commands over SSH. Replace
`erp.yourschool.com` with your domain everywhere. More background:
[Installing on a VPS](https://docs.multischoolerp.com/install/vps).

### B1 — Install the software

```bash
sudo apt update
sudo apt install -y nginx mysql-server unzip supervisor \
  php8.3-fpm php8.3-cli php8.3-mysql php8.3-mbstring php8.3-xml php8.3-curl \
  php8.3-zip php8.3-gd php8.3-bcmath php8.3-intl
```

Raise the upload limit for Online Courses — in `/etc/php/8.3/fpm/php.ini` set:

```
upload_max_filesize = 64M
post_max_size = 64M
```

### B2 — Create the database and import the `.sql`

Choose your own strong password in place of `StrongPasswordHere`:

```bash
sudo mysql -e "CREATE DATABASE school_erp CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;"
sudo mysql -e "CREATE USER 'school_erp'@'localhost' IDENTIFIED BY 'StrongPasswordHere';"
sudo mysql -e "GRANT ALL PRIVILEGES ON school_erp.* TO 'school_erp'@'localhost'; FLUSH PRIVILEGES;"
```

Upload the `.sql` file (e.g. with SFTP to your home folder), then import it:

```bash
mysql -u school_erp -p school_erp < ~/your-file.sql
```

### B3 — Upload and extract the files

Upload the package `.zip` to your home folder, then:

```bash
sudo mkdir -p /var/www/school-erp
sudo unzip ~/your-package.zip -d /var/www/school-erp
ls -a /var/www/school-erp
```

You should see `artisan`, `app`, `public`, `vendor` and `.env` listed directly. If they
sit inside a subfolder, move them up into `/var/www/school-erp`.

### B4 — Edit `.env`

```bash
sudo nano /var/www/school-erp/.env
```

Make the [`.env` edits](#the-env-edits-all-paths) (`DB_DATABASE=school_erp`,
`DB_USERNAME=school_erp`, your password, your `APP_URL`). Save with `Ctrl+O`, `Enter`,
exit with `Ctrl+X`.

### B5 — Set file permissions

```bash
SITE=/var/www/school-erp
sudo chown -R www-data:www-data $SITE
sudo find $SITE -type d -exec chmod 755 {} +
sudo find $SITE -type f -exec chmod 644 {} +
sudo chmod -R 775 $SITE/storage $SITE/bootstrap/cache
sudo chmod 600 $SITE/.env
sudo chmod 755 $SITE/artisan
```

> **Never use 777.** And from now on, run every `artisan` command **as the web user**
> (`sudo -u www-data php artisan …`), never as root — root-owned files cause
> "permission denied" errors days later.

### B6 — Configure Nginx

Create `/etc/nginx/sites-available/school-erp`:

```nginx
server {
    listen 80;
    server_name erp.yourschool.com;
    root /var/www/school-erp/public;
    index index.php;
    charset utf-8;
    client_max_body_size 64M;

    # 1. CRITICAL: private media must route through the application — keep this first
    location ^~ /media/private/ {
        try_files $uri $uri/ /index.php?$query_string;
    }

    # 2. Main routing
    location / {
        try_files $uri $uri/ /index.php?$query_string;
    }

    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/run/php/php8.3-fpm.sock;
    }

    # 3. Static caching — after the private-media rule
    location ~* \.(jpg|jpeg|png|gif|ico|css|js|svg|woff|woff2|ttf|eot)$ {
        try_files $uri /index.php?$query_string;
        expires 30d;
        access_log off;
    }

    location ~ /\.(?!well-known).* {
        deny all;
    }
}
```

Enable it and reload:

```bash
sudo ln -s /etc/nginx/sites-available/school-erp /etc/nginx/sites-enabled/
sudo rm -f /etc/nginx/sites-enabled/default
sudo nginx -t && sudo systemctl reload nginx
sudo systemctl restart php8.3-fpm
```

> **Why the site root is `public`:** Nginx ignores the `.htaccess` file. Pointing it
> anywhere else gives a blank page or a file download.
> **Why the private-media rule:** without it, student documents, ID cards and
> certificates return "not found" while ordinary logos work fine.

### B7 — SSL

```bash
sudo apt install -y certbot python3-certbot-nginx
sudo certbot --nginx -d erp.yourschool.com
```

Confirm `APP_URL` in `.env` starts with `https://`.

### B8 — Application key and storage link

```bash
cd /var/www/school-erp
sudo -u www-data php artisan key:generate --force
sudo -u www-data php artisan storage:link
sudo -u www-data php artisan config:clear
```

### B9 — Add the cron job

Open the **web user's** crontab (so the scheduler runs as `www-data`, not root):

```bash
sudo crontab -u www-data -e
```

Add this line at the bottom, then save:

```
* * * * * cd /var/www/school-erp && php artisan schedule:run >> /dev/null 2>&1
```

Why: [The Cron Job](#the-cron-job).

### B10 — Start the queue worker (Supervisor)

Follow [Setting up Supervisor — plain Ubuntu](#setting-up-supervisor--plain-ubuntu).
Optional but recommended on a VPS. If you skip it, leave
`QUEUE_WORKER_MODE=scheduler` and everything still works.

### B11 — Log in

Open `https://erp.yourschool.com`, log in with the details sent with your purchase and
**change the password immediately**. Then do the
[Post-Install Checklist](#post-install-checklist).

---

## Path C — aaPanel

Replace `yourdomain.com` with your domain everywhere. aaPanel's menu wording changes
between versions; the steps are the same. Commands go in aaPanel's **Terminal** (left
menu) or SSH.

### C1 — Install the software

**App Store** → install **Nginx**, **MySQL 8.0** (or MariaDB 10.5+), **PHP 8.3** (or
8.4), **phpMyAdmin**, and **Supervisor Manager**.

Then **App Store → PHP 8.3 → Setting**:

| Tab | Do this |
|---|---|
| **Install extensions** | Install **fileinfo** (not installed by default), **intl**, **exif**, **opcache** |
| **Disabled functions** | **Remove** `proc_open` and `symlink` from the list (also `shell_exec`, optional — only for server RAM metrics) |
| **Configuration file** / **Upload limit** | `upload_max_filesize = 64M`, `post_max_size = 64M` |

### C2 — Create the site and database

**Website → Add site** → enter your domain, **PHP version 8.3**, and set **Database** to
**MySQL** so it creates one at the same time. Write down the database name, user and
password it shows.

### C3 — Upload the files

1. **Files** → open `/www/wwwroot/yourdomain.com`
2. Delete the default `index.html`, `404.html` (keep `.user.ini` if present)
3. **Upload** the package `.zip`, then right-click → **Unzip**

You should see `artisan`, `app`, `public`, `vendor` and `.env` directly in
`/www/wwwroot/yourdomain.com`. If they are inside a subfolder, move them up.

### C4 — Point the site at `public` and add the rewrite rules

**Website → your site → Site directory**: set **Running directory** to `/public` and
**Save**.

**URL rewrite** (older versions: *Pseudo-static*): choose the **laravel5** template,
then add the private-media rule **above** what the template inserted, so the box reads:

```nginx
location ^~ /media/private/ {
    try_files $uri $uri/ /index.php?$query_string;
}

location / {
    try_files $uri $uri/ /index.php$is_args$query_string;
}
```

**Save**. Without the private-media rule, aaPanel's built-in image caching returns
"not found" for student documents, ID cards and certificates.

### C5 — Import the `.sql`

**Database** → your database → **Import** → upload the supplied `.sql` file → import.
(If the upload is too large, put the file in the site folder with **Files** and import
from Terminal: `mysql -u DBUSER -p DBNAME < /www/wwwroot/yourdomain.com/your-file.sql`,
then delete the `.sql` from the site folder.)

### C6 — Edit `.env`

**Files** → `/www/wwwroot/yourdomain.com` → `.env` → **Edit**. Make the
[`.env` edits](#the-env-edits-all-paths) and save.

### C7 — SSL

**Website → your site → SSL → Let's Encrypt** → apply, then turn on **Force HTTPS**.
Confirm `APP_URL` in `.env` starts with `https://`.

### C8 — Permissions, application key and storage link

In **Terminal**:

```bash
SITE=/www/wwwroot/yourdomain.com
chown -R www:www $SITE
find $SITE -type d -exec chmod 755 {} +
find $SITE -type f -exec chmod 644 {} +
chmod -R 775 $SITE/storage $SITE/bootstrap/cache
chmod 600 $SITE/.env
chmod 755 $SITE/artisan

cd $SITE
sudo -u www /www/server/php/83/bin/php artisan key:generate --force
sudo -u www /www/server/php/83/bin/php artisan storage:link
sudo -u www /www/server/php/83/bin/php artisan config:clear
```

> aaPanel's web user is **`www`**. Always run `artisan` as `www`, never as root. If you
> chose PHP 8.4, use `/www/server/php/84/bin/php` everywhere in this guide.

### C9 — Add the cron job

**Cron → Add task**:

| Field | Value |
|---|---|
| **Type of task** | Shell Script |
| **Name** | `School ERP scheduler` |
| **Execution cycle** | Every **1** minute (*N Minutes* → `1`) |
| **Execute user** (if shown) | `www` |
| **Script content** | see below |

If your aaPanel shows an **Execute user** field and you chose `www`:

```
cd /www/wwwroot/yourdomain.com && /www/server/php/83/bin/php artisan schedule:run >> /dev/null 2>&1
```

If there is no **Execute user** field (the task runs as root), use this instead so the
scheduler still runs as `www`:

```
cd /www/wwwroot/yourdomain.com && sudo -u www /www/server/php/83/bin/php artisan schedule:run >> /dev/null 2>&1
```

Why: [The Cron Job](#the-cron-job).

### C10 — Start the queue worker (Supervisor Manager)

Follow [Setting up Supervisor — aaPanel](#setting-up-supervisor--aapanel). Optional but
recommended. If you skip it, leave `QUEUE_WORKER_MODE=scheduler` and everything still
works.

### C11 — Log in

Open `https://yourdomain.com`, log in with the details sent with your purchase and
**change the password immediately**. Then do the
[Post-Install Checklist](#post-install-checklist).

---

## The Cron Job

### Why you need it

The system does a lot **on its own**: it sends messages, reminders and backups at the
right time. All of that is started by **one command, `schedule:run`, that your server
must call every minute**. That every-minute call is the cron job.

**Without the cron job, the site looks perfectly fine — and nothing automatic ever
happens. No error is shown anywhere.** Specifically:

- Emails, SMS and app notifications that are sent in the background never leave
- Fee invoices, fee due reminders and the daily summary email are never sent
- Exam results with a scheduled release time are never released to parents
- Birthday and festival greetings, and survey cycles, never go out
- Scheduled database backups never run
- Subscription expiry reminders and lock-outs never happen
- Biometric machine punches are never turned into attendance
- Online Course payments and Canteen wallet top-ups are not confirmed with the gateway
  (unless the school set up the gateway webhook)
- On shared hosting: Import Hub imports, bulk marksheets / admit cards and bulk photo
  uploads stay "queued" forever (see [The Queue Worker](#the-queue-worker-supervisor))

This is the number one cause of *"we installed it but SMS is not working"*.

### The exact command for your path

All three run every minute. The panels set "every minute" with a dropdown; in a
crontab file it is the `* * * * *` at the start of the line.

| Path | Command |
|---|---|
| **A — cPanel** (Cron Jobs → Once Per Minute) | `cd /home/CPANELUSER/public_html && /usr/local/bin/php artisan schedule:run >> /dev/null 2>&1` |
| **B — Ubuntu VPS** (crontab line, via `sudo crontab -u www-data -e`) | `* * * * * cd /var/www/school-erp && php artisan schedule:run >> /dev/null 2>&1` |
| **C — aaPanel** (Cron → Shell Script, every 1 minute) | `cd /www/wwwroot/yourdomain.com && sudo -u www /www/server/php/83/bin/php artisan schedule:run >> /dev/null 2>&1` |

| Part | Meaning |
|---|---|
| `cd …` | The folder that holds `artisan` — the folder you uploaded, **not** `public` |
| `/usr/local/bin/php` | Where PHP lives on that server |
| `schedule:run` | "Do whatever is due right now" |
| `>> /dev/null 2>&1` | Stops the server emailing you every minute |

> **The PHP path is the usual trouble-maker on shared hosting.** If cron emails you
> *"php: command not found"* or a PHP version error, ask your host for the PHP 8.3
> command-line path — common ones are `/usr/local/bin/php`,
> `/opt/cpanel/ea-php83/root/usr/bin/php` and `/opt/alt/php83/usr/bin/php`.
> After you log in, **Server Health → Maintenance → Scheduled Tasks (Cron)** also shows
> a ready-made command with your server's folder filled in. If the PHP part of that
> command ends in `php-fpm` or `lsphp`, that is the web server's PHP, not the
> command-line one — use one of the paths above instead.

### If your host has no cron jobs at all

Some very basic hosting can only "fetch a URL" on a timer. **Server Health →
Maintenance → Scheduled Tasks (Cron)** shows a second line for that — a web address
that runs the scheduler when it is opened. Give that address to your host's URL
scheduler, set to every minute. Use this only when a real cron job is impossible; a
real cron job is more reliable.

### Checking it works

1. **Server Health → Maintenance → Run Scheduler** — pressing it proves the system
   itself is fine
2. Wait a few minutes, then **Server Health → Self-Tests → Run Now** — the scheduler
   check turns green only when your cron job is really calling it
3. Send yourself a test notice. If it arrives, the whole chain works

If messages never arrive and no error appears anywhere, check the cron job **first** —
before email settings, before the SMS provider.

📖 More: [The cron job](https://docs.multischoolerp.com/install/cron-job)

---

## The Queue Worker (Supervisor)

### Why you need it

Some work is too slow to do while someone waits on a screen: importing a whole school
from Excel, printing marksheets or admit cards for every class, uploading hundreds of
photos, processing biometric punches, sending a platform-wide message. The system puts
that work in a **queue**, and a **queue worker** — a background process — works through
it.

**Without a worker, that work just waits.** Imports stay at "queued", bulk prints never
finish, and background messages are never sent — again with no error on screen.

You have two ways to run the worker. Pick one:

| Mode | `.env` line | Who runs the worker | Best for |
|---|---|---|---|
| **Scheduler** (default) | `QUEUE_WORKER_MODE=scheduler` | Your cron job starts a short worker every minute | **Shared hosting** — and any server without Supervisor |
| **Supervisor** | `QUEUE_WORKER_MODE=supervisor` | Supervisor keeps one worker running all the time, and restarts it if it stops | **VPS and aaPanel** — faster, lighter on the server |

> **Shared hosting fallback:** Supervisor is not available on shared hosting, and you
> do not need it. Leave `QUEUE_WORKER_MODE=scheduler`: each minute the cron job starts a
> worker that processes everything waiting and exits within a minute. The only
> difference you will notice is that background work can start up to a minute later.
> This needs the `proc_open` PHP function to be enabled.

> ⚠️ **Never set `supervisor` without a running Supervisor worker.** The cron job then
> stops starting workers, and queued work waits forever. If Supervisor is ever removed
> or stops, set the line back to `scheduler`.

### Setting up Supervisor — plain Ubuntu

1. Supervisor was installed in step B1. Create
   `/etc/supervisor/conf.d/school-erp-worker.conf`:

   ```ini
   [program:school-erp-queue-worker]
   process_name=%(program_name)s_%(process_num)02d
   command=php /var/www/school-erp/artisan queue:work database --sleep=3 --tries=3 --max-time=3600 --memory=256 --timeout=120
   directory=/var/www/school-erp
   user=www-data
   numprocs=2
   autostart=true
   autorestart=true
   stopasgroup=true
   killasgroup=true
   stopwaitsecs=1900
   startsecs=5
   startretries=3
   redirect_stderr=true
   stdout_logfile=/var/www/school-erp/storage/logs/queue-worker.log
   stdout_logfile_maxbytes=10MB
   stdout_logfile_backups=3
   ```

   On a 1–2 GB RAM server use `numprocs=1`; on 4+ cores and 4 GB+ you can raise it
   to 3–4.

2. Start it:

   ```bash
   sudo supervisorctl reread
   sudo supervisorctl update
   sudo supervisorctl status
   ```

   `status` should show the worker(s) as **RUNNING**.

3. In `.env`, set `QUEUE_WORKER_MODE=supervisor` and add one line:

   ```
   DB_QUEUE_RETRY_AFTER=1900
   ```

   (Large imports may run for up to 30 minutes; this stops a second worker picking up
   the same import while the first is still working on it.)

4. Apply it:

   ```bash
   cd /var/www/school-erp
   sudo -u www-data php artisan config:clear
   sudo -u www-data php artisan queue:restart
   ```

### Setting up Supervisor — aaPanel

1. **App Store → Supervisor Manager → Setting → Add Daemon**:

   | Field | Value |
   |---|---|
   | **Name** | `school-erp-queue-worker` |
   | **Run user** | `www` |
   | **Run dir** | `/www/wwwroot/yourdomain.com` |
   | **Start command** | `/www/server/php/83/bin/php /www/wwwroot/yourdomain.com/artisan queue:work database --sleep=3 --tries=3 --max-time=3600 --memory=256 --timeout=120` |
   | **Processes** | `2` (use `1` on a 1–2 GB RAM server) |

2. Confirm it shows as **running** in the Supervisor Manager list.
3. In `.env`, set `QUEUE_WORKER_MODE=supervisor` and add `DB_QUEUE_RETRY_AFTER=1900`
   (why: see step 3 above).
4. In **Terminal**:

   ```bash
   cd /www/wwwroot/yourdomain.com
   sudo -u www /www/server/php/83/bin/php artisan config:clear
   sudo -u www /www/server/php/83/bin/php artisan queue:restart
   ```

### After any later change

A Supervisor worker keeps the old settings and code in memory. **Whenever you edit
`.env` or upload an update, run `php artisan queue:restart`** (as the web user) so the
worker restarts with the new ones. Supervisor brings it straight back. In scheduler
mode this is not needed — a fresh worker starts every minute.

---

## Replace the Application Key

`APP_KEY` in `.env` is the master lock of your installation: it encrypts saved gateway,
SMS and email passwords, and signs the **QR codes on ID cards** and the private links to
student documents.

**The key in the package is the same for every buyer.** Replace it on installation
day — paths B and C already did this in B8 / C8; on shared hosting, see A6.

**Do it before** you enter payment gateway, SMS or email details and **before you print
any ID card**. Changing the key later makes saved passwords unreadable (re-enter them)
and **every printed ID card stops scanning**.

> **Never use an online "Laravel key generator."** Generate the key on your own server
> with `php artisan key:generate --force`, or ask us for one.

📖 More: [The application key](https://docs.multischoolerp.com/install/application-key)

---

## Optional — Better-Quality PDFs (VPS and aaPanel)

Skip this on shared hosting. Everything works without it — PDFs simply render with the
built-in fallback engine, which is plainer.

On a VPS or aaPanel server, install Google Chrome once and the system uses it for all
PDFs and printable documents (fee receipts, marksheets, certificates, ID cards,
payslips):

```bash
wget -q -O /tmp/chrome.deb https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb && sudo apt-get install -y /tmp/chrome.deb
```

Add the path to `.env`:

```
PDF_CHROME_PATH="/opt/google/chrome/google-chrome"
```

Then clear the config, restart the worker, and restart PHP:

```bash
php artisan config:clear && php artisan queue:restart
sudo systemctl restart php8.3-fpm      # plain Ubuntu
sudo systemctl restart php-fpm-83      # aaPanel
```

(Run the `php artisan` part as the web user, as in B8 / C8.)

> **Do not use `apt install chromium-browser`.** On Ubuntu 20.04 and newer that
> installs the *snap* version, which the web server cannot launch. PDFs then silently
> use the plain fallback engine, while command-line tests still report success.

Confirm on **Server Health → Self-Tests → Run Now** — the PDF Engine check turns green.
That button tests the web server's own environment, which a command-line check does
not. Missing-library fixes are in `docs/PDF_ENGINE_SETUP.md` inside the package.

> The same Chrome also powers **image moderation**. Without Chrome, moderation scanning
> is unavailable — nothing else is affected.

---

## Optional — Flexible Pricing

Skip this if you sell one fixed price per plan — that is the default and needs no
configuration.

To sell **per-student**, **tiered**, **hybrid** plans or **paid add-ons**, set this in
`.env`:

```
BILLING_FLEXIBLE_PLANS_ENABLED=true
```

Then press **Server Health → Maintenance → Clear Config Cache** (or run
`php artisan config:clear`). The billing-model picker appears in **Superadmin → Plans**,
along with **Plan Add-ons**.

> **Seat overage never blocks a school** — extra students are reconciled at the next
> renewal and shown before checkout. **Switching the flag back off is not a rollback** —
> it stops *new* non-flat plans; a school already on one keeps the pricing it was sold.

---

## Post-Install Checklist

Log in as super admin and open **Sidebar → Server & Health → Server Health**. It checks
your server and tells you, in plain language, what is still wrong.

| Check | Where | What to do |
|---|---|---|
| **Self-Tests** | Self-Tests tab → **Run Now** | Everything green. The scheduler check proves your cron job works |
| **Compatibility Matrix** | Compatibility Matrix tab | PHP 8.3/8.4, no missing extensions or disabled functions |
| **Media Storage Link** | Maintenance tab | If "Not linked" → **Create Storage Link Now** |
| **Scheduled Tasks (Cron)** | Maintenance tab | Matches the cron job you added |
| **Folder permissions** | Maintenance tab → File Permissions & Security | `storage/` and `bootstrap/cache` writable |
| **`.env` is hidden** | Maintenance tab → **Test /.env is blocked** | Must show "not found" / "forbidden" — never the file's contents |
| **Private media** (VPS / aaPanel) | Maintenance tab → **Test private-media routing** | A *styled* error page from the system is correct; a bare web-server 404 means the private-media rule is missing |
| **PDF Engine** | Self-Tests | Green = full-quality PDFs. A warning only means the plainer fallback engine |
| **Queue worker** (Supervisor only) | `sudo supervisorctl status` or Supervisor Manager | Shows **RUNNING** |

Clear everything it flags **before you add your first school**.

---

## After It Is Running

| Order | Task | Guide |
|---|---|---|
| 1 | Change the default password | — |
| 2 | Confirm the application key was replaced | [Replace the Application Key](#replace-the-application-key) |
| 3 | Set up email | [Setting up email](https://docs.multischoolerp.com/configure/email) |
| 4 | Set up SMS | [Setting up SMS](https://docs.multischoolerp.com/configure/sms) |
| 5 | Set up WhatsApp (optional) | [Setting up WhatsApp](https://docs.multischoolerp.com/configure/whatsapp) |
| 6 | Set up payment gateway | [Setting up payment gateways](https://docs.multischoolerp.com/configure/payment-gateways) |
| 7 | Decide your plans | **Superadmin → Plans** — flat plans work out of the box; add the **Canteen** and **Online Courses** add-ons to the plans that include them |
| 8 | Create your first school | [Creating your first school](https://docs.multischoolerp.com/superadmin/creating-a-school) |
| 9 | Set up backups | [Backups & restore](https://docs.multischoolerp.com/superadmin/backups) — schedule the nightly backup in **Backup Management** |
| 10 | Brand the mobile apps | **Superadmin → Settings → Branding → Mobile App Branding** — Parent, Staff and Driver each carry their own name, logo and colours |

> **CCTV:** parent live-view is **off** by default and every camera is opted out.
> Nothing is exposed until a school assigns cameras to classes and turns the policy on
> under **CCTV → CCTV Cameras**.

> **Face recognition** needs a VPS and enrolled student photos. **Biometric →
> Recognition Readiness** shows exactly what is missing. Low-confidence matches go to
> **Biometric → Face Review** for a human decision; they never become attendance on
> their own.

---

## Troubleshooting

| What you see | Almost always means |
|---|---|
| Blank white page, or the browser downloads a file | **Shared hosting:** `.htaccess` is missing (hidden file — turn on "show hidden files"). **VPS / aaPanel:** the site root / running directory is not `public` |
| "No application encryption key has been specified" | `APP_KEY` in `.env` is empty — run `php artisan key:generate --force` or contact us |
| Database connection error | Wrong `DB_*` values in `.env` (cPanel: remember the prefix), or `DB_HOST` should be `localhost` on your host |
| Login page loads but the password is rejected | The `.sql` was never imported, or was imported into a different database than the one in `.env` |
| `.sql` import fails or times out | File too large for phpMyAdmin — use the panel's import tool, the terminal, or ask your host |
| The site shows detailed error pages with code | `APP_DEBUG` is `true` — set it to `false` |
| Demo login buttons on the login page | `DEMO_MODE` is `true` — set it to `false` |
| Site works but no email, no SMS, no reminders | The cron job is missing or wrong — see [The Cron Job](#the-cron-job) |
| Imports stay "queued", bulk prints never finish | No queue worker: the cron job is missing (scheduler mode), or `QUEUE_WORKER_MODE=supervisor` with no running Supervisor worker |
| A change in `.env` seems ignored | **Server Health → Maintenance → Clear Config Cache**; with Supervisor, also `php artisan queue:restart` |
| Logos and uploads show as broken images | Storage link missing — **Server Health → Maintenance → Create Storage Link Now** |
| Logos work, but documents / ID cards / certificates say "not found" (VPS / aaPanel) | The private-media rule is missing or below the caching rules — B6 / C4 |
| "open_basedir restriction in effect" (aaPanel) | **Website → your site → Site directory** → untick **Anti-XSS attack (open_basedir)** and save |
| "Permission denied" in `storage/logs` | Wrong owner, or `artisan` / cron ran as root — redo the permission commands (B5 / C8) |
| 502 Bad Gateway (VPS / aaPanel) | PHP-FPM is not running, or the site uses the wrong PHP version — restart PHP, confirm 8.3/8.4 |
| Online Course upload refused | PHP `upload_max_filesize` / `post_max_size` below 64M (VPS: also Nginx `client_max_body_size`) |
| PDFs and ID cards look plain | No Chrome on the server — see [Better-quality PDFs](#optional--better-quality-pdfs-vps-and-aapanel). Never a data problem |
| No per-student / tiered / hybrid option | Flexible pricing is off — see [Flexible pricing](#optional--flexible-pricing) |
| **School → Explore** missing for a user | The ERP Navigator is granted to school admin only by default. Grant `system.navigator.view` under **Roles & Permissions** |
| A sidebar module is missing | The school's plan does not include it, or the role lacks the permission — check **Superadmin → Plans** and the role |

---

## Quick Links to Full Documentation

| Topic | Link |
|---|---|
| **Installation overview** | [docs.multischoolerp.com/install](https://docs.multischoolerp.com/install/) |
| **Which hosting do I need?** | [docs.multischoolerp.com/guide/choose-hosting](https://docs.multischoolerp.com/guide/choose-hosting) |
| **Server requirements** | [docs.multischoolerp.com/install/server-requirements](https://docs.multischoolerp.com/install/server-requirements) |
| **Shared hosting guide** | [docs.multischoolerp.com/install/shared-hosting](https://docs.multischoolerp.com/install/shared-hosting) |
| **VPS guide** | [docs.multischoolerp.com/install/vps](https://docs.multischoolerp.com/install/vps) |
| **The cron job** | [docs.multischoolerp.com/install/cron-job](https://docs.multischoolerp.com/install/cron-job) |
| **The application key** | [docs.multischoolerp.com/install/application-key](https://docs.multischoolerp.com/install/application-key) |
| **Server health** | [docs.multischoolerp.com/superadmin/server-health](https://docs.multischoolerp.com/superadmin/server-health) |
| **PDF engine setup** | `docs/PDF_ENGINE_SETUP.md` (inside the package) |
| **Email setup** | [docs.multischoolerp.com/configure/email](https://docs.multischoolerp.com/configure/email) |
| **SMS setup** | [docs.multischoolerp.com/configure/sms](https://docs.multischoolerp.com/configure/sms) |
| **WhatsApp setup** | [docs.multischoolerp.com/configure/whatsapp](https://docs.multischoolerp.com/configure/whatsapp) |
| **Payment gateways** | [docs.multischoolerp.com/configure/payment-gateways](https://docs.multischoolerp.com/configure/payment-gateways) |
| **Custom domains** | [docs.multischoolerp.com/configure/custom-domains](https://docs.multischoolerp.com/configure/custom-domains) |
| **Platform settings** | [docs.multischoolerp.com/superadmin/general-settings](https://docs.multischoolerp.com/superadmin/general-settings) |
| **Creating a school** | [docs.multischoolerp.com/superadmin/creating-a-school](https://docs.multischoolerp.com/superadmin/creating-a-school) |
| **Backups & restore** | [docs.multischoolerp.com/superadmin/backups](https://docs.multischoolerp.com/superadmin/backups) |
| **What's new in this release** | `CHANGELOG-v3.8.0-beta.md` (inside the package) |

---

## 📞 ProjectWorlds Support

| Channel | Details |
|---|---|
| WhatsApp | +91 62630 56779 |
| Email | contact@projectworlds.com |
| Website | https://projectworlds.com |

If any step fails, **stop immediately** and contact us with the full error output.

— *ProjectWorlds Team*
