Skip to content
PHP versions Install PHP versions side by side, switch each site's runtime, and tune ini / extensions / FPM per version.

PHP versions

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 — restart a version’s shared master (php<x.y>-fpm, or Remi’s php<xy>-php-fpm on AlmaLinux/Rocky). The card counts the version’s dedicated masters too: an isolated site runs its own mzfpm-<user> master, which follows the shared restart on Ubuntu/Debian; on AlmaLinux/Rocky the panel reloads each one after the shared restart.
  • Dedicated PHP-FPM masters — a list under the version cards with every isolated site’s mzfpm-<user> unit per PHP version and a Reload button (runs site.isolate on the already isolated site: a verified graceful reload; a master that does not come back puts the site on the shared master).
  • 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.

Each PHP site (WordPress, PHP, Laravel…) has a PHP hardening profile, set in the site drawer under Settings → PHP hardening (agent 0.2.159+, every plan):

ProfileWhat it changes
balanced (default)The pool every site always had: exec, shell_exec, system, passthru, proc_open, popen, curl_multi_exec, parse_ini_file, show_source and pcntl_exec disabled. Sites that never picked a profile run this, unchanged.
strictbalanced, plus the rest of the process family (proc_*, pcntl_*), the POSIX setters (posix_kill, posix_setuid…), dl and putenv disabled; open_basedir narrowed to the site folder, its tmp and its cache folder (where WordPress queues page-cache purges; since agent 0.2.162, re-apply strict on older sites); allow_url_include, allow_url_fopen, expose_php and display_errors off; session cookies httponly, samesite=Lax, use_strict_mode, and secure when the site has HTTPS. Upload and post size limits stay the same.
offNo disabled functions at all, for apps that really need to run programs. The site keeps its own user, open_basedir, its own tmp and session directory. Risk: a hacked PHP file can run any command as the site user.

Applying a profile writes the site’s pool, runs php-fpm -t against the master that serves it (shared or the site’s own sandboxed master) and gracefully reloads only that master. If the test fails the old pool is put back and the job fails with fpm_test_failed. The job output lists disabled_functions, plus added_vs_balanced (what strict blocks on top of the default) and allowed_vs_balanced (what off allows).

The profile is stored as PHP_PROFILE in the site registry and survives a PHP version switch, a clone and isolating the site onto its own PHP-FPM master. If you enable HTTPS after choosing strict, apply strict again to add the secure cookie flag.

Each PHP site (WordPress, PHP, Laravel…) can override a set of php.ini values for itself only, in the site drawer under Settings → PHP settings (php.ini) (agent 0.2.160+, every plan). Leave a field empty to keep the server value; Reset all drops every override.

KeyAccepted values
upload_max_filesize, post_max_sizea size from 1M to 16G (256M, 1G)
memory_limit32M to 16G (no -1)
max_execution_time / max_input_timeseconds, 0–86400 (max_input_time also -1)
max_input_vars, max_file_uploadsa number (100–1000000, 1–1000)
display_errors, display_startup_errors, short_open_tag, opcache.validate_timestampsOn / Off
date.timezonean IANA zone such as Europe/Berlin, or UTC
error_reportingE_ALL, E_ALL & ~E_DEPRECATED & ~E_STRICT, E_ALL & ~E_NOTICE, 0 or a number
output_buffering, session.gc_maxlifetime, default_socket_timeout, opcache.revalidate_freqOn/Off/bytes, seconds
opcache.max_accelerated_files, opcache.interned_strings_buffer, opcache.jit_buffer_size, opcache.jit, realpath_cache_size, realpath_cache_ttlisolated sites only (read when PHP-FPM starts)

The values go into the site’s own PHP-FPM pool, replacing the pool’s line for the same key (never a second copy), so they win over the server-wide php.ini. Upload size, memory and time limits stay admin values that the app cannot raise with ini_set. A site on its own PHP-FPM master (isolated) also gets /etc/mz/fpm/<user>/conf.d/90-mz-site.ini, which is the only place the startup-only OPcache and realpath cache sizes can be set; a site on the shared master answers not_isolated for those. Every change is tested with php-fpm -t against the master that serves the site and only that master reloads gracefully; a rejected change puts the previous files back (fpm_test_failed). The overrides are kept in the site registry (PHP_INI) and survive a PHP version switch, a clone and isolation. The answer warns when post_max_size is smaller than upload_max_filesize or memory_limit is above the site’s memory cap.

Not overridable here: what the hardening profile controls (allow_url_fopen, expose_php, session cookies, disable_functions, open_basedir), paths, and opcache.memory_consumption (sized from the site’s resource plan).

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-setsets the version’s pool defaults and applies them to its site pools
Restart poolphp.restartreloads php<x.y>-fpm
Tuning planphp.optimize / tuning.retune-allcomputes/applies RAM-based sizing
Site hardening profilesite.php-profilerewrites one site’s pool, php-fpm -t, reloads its master
Site php.ini overridessite.php-inirewrites one site’s pool (+ its master’s 90-mz-site.ini when isolated), php-fpm -t, reloads its master

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 per-site resource limits, on every plan) 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:

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
mz site php-profile example.com --json # read the site's profile
mz site php-profile example.com --set strict --json # balanced | strict | off
mz site php-ini example.com --json # read the site's overrides
mz site php-ini example.com --set upload_max_filesize=256M --set post_max_size=256M --json
mz site php-ini example.com --unset memory_limit --json # or --reset for all

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

MCP (mcp.mzpanel.com) and the REST API (/v1/api, same token) are on every plan. Call jobs_schema (or GET /v1/api/job-kinds/{type}) before jobs_create / POST /v1/servers/{id}/jobs to get each kind’s exact body, token level and scope.

GoalMCP toolJob kind
Installed versionsphp_list, servers_inventory with kind phpphp.list
Switch one sitejobs_createphp.switch {domain, version}
Box defaultjobs_createphp.set-default {version}
Install / uninstall a versionjobs_createphp.install, php.uninstall (full)
Extensions, php.ini, FPM pooljobs_createphp.ext, php.ext-install, php.config-set, php.config-set-raw, php.fpm-set, php.restart
Read or set a site’s hardening profilejobs_createsite.php-profile {domain, profile?} (profile: balanced, strict, off; omit it to read)
Read or change a site’s php.ini overridesjobs_createsite.php-ini {domain, set?: {key: value}, unset?: [key], reset?} (no change field = read; answers overrides, defaults, allowed, master_only, warnings)
  • FPM tab = per-version defaults for the per-site pools. MZPanel runs a dedicated pool per site, sized from RAM. Editing the FPM tab in a version’s Configure drawer sets that version’s pool defaults. agent 0.2.157+ copy them into every site pool of the version (and every new one), test the config with php-fpm -t and reload gracefully; a rejected value changes nothing (fpm_test_failed). A site with a concurrency cap keeps its own pm.max_children. Older agents only record the values. To re-size the pools from RAM instead, use Optimize (the same sizing site-create uses).
  • A plugin broke after switching to strict. Read the job output’s added_vs_balanced and the site’s ~/logs/php-error.log (Call to undefined function or “has been disabled for security reasons”), then go back to balanced. fpm_test_failed means php-fpm rejected the pool; nothing changed. Agents older than 0.2.159 answer site.php-profile with exit 127 (update the agent).
  • A php.ini override was refused. bad_key = not on the allowlist above; bad_value = outside the accepted range (the message gives it); not_isolated = a startup-only key on a site that shares the PHP-FPM master (isolate the site first); profile_conflict = display_errors=On while the strict hardening profile forces it off. Agents older than 0.2.160 answer site.php-ini with exit 127.
  • 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 an agent-offline banner; installing, switching, restarting and saving all need the agent online.