PHP versions
Nội dung này hiện chưa có sẵn bằng ngôn ngữ của bạn.
The PHP versions section of a server (/servers/:id/php) is where you install
PHP runtimes side by side, pick which version each site runs, and tune each
version’s php.ini, extensions and FPM pool. Every site gets its own isolated
PHP-FPM pool, so a legacy site can stay on 8.1 while a new one runs 8.3 on the
same box. It’s available on all plans.
Switch a site’s PHP version, step by step
Section titled “Switch a site’s PHP version, step by step”- Scroll to the Sites by PHP version panel — a full-width list of every site on the box with its current runtime.
- Find the site, hover its version, and click to open the inline version picker.
- Pick a target version. The switch is per-site and zero-downtime — the agent repoints just that site’s FPM pool and reloads, leaving every other site untouched. A spinner runs on the row until it lands.
What else you can do
Section titled “What else you can do”The top of the page is a searchable grid of version cards (one per installed runtime) with a status filter and two actions in the toolbar.
- Filter and search — segment by status (All / Active / Inactive) and search across versions, extension names, or the domains running each version.
- Install version — opens a drawer to tick which versions to add; the install streams a live progress log (apt can take a minute per version) and survives closing/reopening the drawer.
- Set as default — mark a version as the box default for new sites (a Default badge shows on the card). This does not touch running pools.
- Configure — open the per-version drawer (Settings / Extensions / FPM
tabs) to review and adjust
php.inidirectives, toggle or install extensions, and set the FPM pool baseline. There’s also a rawphp.inieditor for anything beyond the guided fields. - Restart FPM — reload a version’s
php<x.y>-fpmservice. - Uninstall — remove a version. Guarded: you can’t remove the box default, nor a version still hosting sites (move those sites first).
- Optimize — open a hardware-aware tuning plan across all versions (per-site FPM sizing from RAM + per-version OPcache + missing extensions), review the diff, and apply the levers you want.
EOL runtimes (7.4, 8.0) are still installable for legacy sites and carry an EOL / EOL soon badge so you know they’re out of security support.
How it works
Section titled “How it works”Actions on this page dispatch php.* jobs to the server’s agent, which runs them
natively (no shell-out to a legacy script):
| Action | Job | Agent runs |
|---|---|---|
| List versions | php.list | php list --json |
| Switch a site | php.switch | repoints one site’s FPM pool |
| Set box default | php.set-default | updates the default for new sites |
| Install / uninstall | php.install / php.uninstall | apt add/remove a runtime |
| Toggle extension | php.ext | enable/disable a loaded module |
| Install extension | php.ext-install | apt php<x.y>-<name> (or ionCube) |
Save php.ini | php.config-set / php.config-set-raw | writes managed overrides, reload-tested |
| Save FPM pool | php.fpm-set | writes the version’s pool baseline |
| Restart pool | php.restart | reloads php<x.y>-fpm |
| Tuning plan | php.optimize / tuning.retune-all | computes/applies RAM-based sizing |
Per-site isolation is the foundation. Each site runs its own PHP-FPM pool
under its own Linux user, with an open_basedir jail so it can only see its own
files. That’s what makes per-site versions (and Pro-plan per-site resource limits)
possible in the first place.
Reads are cache-first. The version list comes from an agent-pushed inventory
snapshot (php), so the page loads instantly and an offline box still shows its
last-known real versions. The Configure drawer’s per-version detail (extensions +
php.ini + FPM values) is bundled into one cached php_detail snapshot, refreshed
every five minutes, on connect, and after any php.* write — so the drawer opens
instantly with a “synced X ago” indicator and a Refresh button. Writes always
run live against the online agent.
CLI & automation
Section titled “CLI & automation”Every action here maps to an mz command on the box — the same engine the
dashboard drives. SSH in and run them directly, or let an on-box AI (ClaudeCode)
run them:
mz php list --json # installed versions, default, site countsmz php switch example.com 8.3 --json # move one site to a versionmz php set-default 8.3 --json # default runtime for new sitesmz php config set 8.3 memory_limit 256M --json # a php.ini directivemz php ext 8.3 imagick enable --json # toggle an extensionmz php restart 8.3 --json # reload php8.3-fpmPass a sub-action and --json for machine output. See
The mz CLI and the command catalog.
Gotchas & troubleshooting
Section titled “Gotchas & troubleshooting”- FPM tab = a per-version baseline, not the live per-site pools. MZPanel runs a dedicated pool per site, sized from RAM. Editing the FPM tab in a version’s Configure drawer writes that version’s pool default — an inert baseline new per-site pools inherit. To actually re-size the live per-site pools, use Optimize (it runs the same RAM-based sizing that site-create uses).
- Uninstall is guarded. You can’t remove the box default or a version that still hosts sites — move those sites to another version first, or set a different default. The card’s Uninstall action is disabled with the reason on hover.
- Set default doesn’t move existing sites. It only changes which runtime new sites get. Existing sites keep their version until you switch them explicitly.
- Installing a version can take a minute. It’s an apt install; the progress log streams live — leave it running even if you close the drawer.
- Offline servers are read-only. With the agent offline the page shows the last-known versions from cache behind a preview banner; installing, switching, restarting and saving all need the agent online.
Related
Section titled “Related”- Server overview — the server’s status and sections.
- Cron jobs — scheduled tasks on the same box.
- Site overview — where a single site’s PHP version shows.
- The mz CLI — driving the box from the command line.