contPanel integration — NativeLoad Secure Runtime
This guide shows how contPanel ships the NativeLoad runtime as an automatic install. The goal: contPanel installs the engine silently when preparing a server, detects an existing install and skips it (no double install), and offers update and removal. There is no per-user key step — once the engine is installed, protected applications run on that server.
Install & update order (critical)
contPanel's own PHP files are protected with the engine, so the runtime must always be ready before contPanel — on both install and update. Otherwise contPanel's encoded files cannot be resolved and will not run. The flow, for install and update alike:
- Check with
contpanel-hook.sh --status:
active:trueand version current → the engine is ready; continue.active:truebut older version → run--update.- not installed → run
contpanel-hook.shto install.
- Only after the engine is confirmed ready, install/update contPanel.
- If the engine step fails, do not proceed to contPanel — surface an error.
1. Place the files
Drop the package into contPanel's addon directory, e.g.:
/usr/local/contpanel/addons/eploader/
├─ src/ (install.sh, ep-detect.sh, contpanel-hook.sh, panel-install.sh …)
├─ bin/ (compiled engines: eploader-phpXX-nts-x86_64.so …)
└─ docs/
Make the scripts executable:
chmod +x /usr/local/contpanel/addons/eploader/src/*.sh
2. Auto-install hook
When contPanel prepares a new server (or the user clicks "Enable source protection"), call:
/usr/local/contpanel/addons/eploader/src/contpanel-hook.sh
The hook, in order:
- Checks whether the engine is already installed via
ep-detect.sh. - If installed → returns
already-installedand does nothing (it respects a
manual install).
- Otherwise → installs the engine matching the PHP build, provisions the
runtime key, and verifies it.
There is no per-user key step.
3. Status in the panel
/usr/local/contpanel/addons/eploader/src/contpanel-hook.sh --status
# {"installed":true,"active":true,"version":"2.1.0","ext_dir":"...","so":true,"php":"8.3"}
Badge from PHP:
$st = json_decode(shell_exec(
'/usr/local/contpanel/addons/eploader/src/contpanel-hook.sh --status'), true);
if (!empty($st['active'])) $badge = 'Active · v'.$st['version'];
elseif (!empty($st['so'])) $badge = 'Installed (restart the web service)';
else $badge = 'Not installed';
4. Version check & update notifications
- Installed version: the
versionfield from--status. - Latest version: read
versionfromhttps://encoderphp.com/loader/version.json. - Compare with semver:
- installed
<latest → show "Update available (X → Y)" and a button that
runs --update.
- equal → show an "Up to date" badge.
- installed
<min_supported→ show a "Required update" warning.
Run the check on panel load and from a daily cron.
5. Multiple PHP versions
Install for each PHP version by pointing the hook at that version's binaries:
for v in 7.2 7.4 8.1 8.2 8.3 8.4; do
base="/opt/contpanel/php/$v/bin"
PHP_BIN="$base/php" PHPIZE="$base/phpize" PHPCONFIG="$base/php-config" \
/usr/local/contpanel/addons/eploader/src/contpanel-hook.sh
done
Each run checks "already installed" independently.
6. Update / Uninstall / Adopt a manual install
| Action | Command |
|---|---|
| Install (if absent) | src/contpanel-hook.sh |
| Status (JSON) | src/contpanel-hook.sh --status |
| Update (even if installed by hand) | src/contpanel-hook.sh --update |
| Uninstall | src/contpanel-hook.sh --uninstall |
Manually installed, then contPanel arrives: if the engine was installed by hand earlier, contPanel detects it on the first --status/hook call (ep-detect → active:true) and treats it as managed — it will not install twice. From there it can update (--update) and remove (--uninstall). Detection is based on extension_loaded, so it does not matter whether the engine was installed by hand or by the panel.
contPanel UI: on the "Protected PHP" screen, wire three actions → Enable (contpanel-hook.sh), Update (--update), Remove (--uninstall); feed the status badge from the--statusJSON. Never ask the user for a "key" — there is no key in universal mode.
7. Notes
- After install/update, restart the web service (
php-fpm/httpd/
apache2 / lsws). The installer does this automatically unless EP_NORESTART=1 is set.
- The master key is unchanged across 2.0.x and 2.1.x, so updating does not
break already-protected files.
- To refresh the compiled engines, replace the
.sofiles inbin/and run the
hook with EP_FORCE=1.