Bỏ qua để đến nội dung
PHP versions Install PHP versions side by side, switch each site's runtime, and tune ini / extensions / FPM per version.

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”
  1. Scroll to the Sites by PHP version panel — a full-width list of every site on the box with its current runtime.
  2. Find the site, hover its version, and click to open the inline version picker.
  3. 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.

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.ini directives, toggle or install extensions, and set the FPM pool baseline. There’s also a raw php.ini editor for anything beyond the guided fields.
  • Restart FPM — reload a version’s php<x.y>-fpm service.
  • 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.

Actions on this page dispatch php.* jobs to the server’s agent, which runs them natively (no shell-out to a legacy script):

ActionJobAgent runs
List versionsphp.listphp list --json
Switch a sitephp.switchrepoints one site’s FPM pool
Set box defaultphp.set-defaultupdates the default for new sites
Install / uninstallphp.install / php.uninstallapt add/remove a runtime
Toggle extensionphp.extenable/disable a loaded module
Install extensionphp.ext-installapt php<x.y>-<name> (or ionCube)
Save php.iniphp.config-set / php.config-set-rawwrites managed overrides, reload-tested
Save FPM poolphp.fpm-setwrites the version’s pool baseline
Restart poolphp.restartreloads php<x.y>-fpm
Tuning planphp.optimize / tuning.retune-allcomputes/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.

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:

Terminal window
mz php list --json # installed versions, default, site counts
mz php switch example.com 8.3 --json # move one site to a version
mz php set-default 8.3 --json # default runtime for new sites
mz php config set 8.3 memory_limit 256M --json # a php.ini directive
mz php ext 8.3 imagick enable --json # toggle an extension
mz php restart 8.3 --json # reload php8.3-fpm

Pass a sub-action and --json for machine output. See The mz CLI and the command catalog.

  • 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.