Skip to content

PHP

Yerd downloads prebuilt static PHP builds and runs an FPM pool per installed version. The PHP Versions guide covers this in depth.

Choosing the version

The use command is overloaded by argument count:

CommandDescriptionExample
yerd use <VERSION>Set the global default: the terminal php shim and the per-site fallback.yerd use 8.5
yerd use <SITE> <VERSION>Set the PHP version for a single named site.yerd use blog 8.3
sh
yerd use 8.5          # global default for the `php` shim and new sites
yerd use blog 8.3     # pin one site to 8.3

After a successful global yerd use <version> (human output only), yerd prints a hint telling you which directory holds the managed php shim and warns if a different php is found earlier on your PATH and would shadow it.

Managing installed versions

CommandDescriptionExample
yerd install php <VERSION>Install a PHP version (downloads a prebuilt static build).yerd install php 8.5
yerd uninstall php <VERSION>Uninstall a PHP version (removes its files; blocked if in use).yerd uninstall php 8.3
yerd update php [VERSION]Update a PHP version to the latest release. Omit the version to update every installed version.yerd update php
yerd restart php [VERSION]Restart a PHP FPM pool. Omit the version to restart every running pool.yerd restart php 8.5
yerd list php [--check] [--available]List installed PHP versions and the global default.yerd list php
sh
yerd install php 8.5      # download + run an 8.5 FPM pool
yerd update php           # update all installed versions to latest
yerd update php 8.5       # update just 8.5
yerd restart php          # restart every running pool
yerd uninstall php 8.3    # remove 8.3 (refused if a site still uses it)

yerd list php flags

FlagDescription
--checkPoll the distribution now to refresh "update available" status. Without it, status is served from the daemon's cache (no network).
--availableList the versions installable from the distribution instead, tagging ones already installed. Takes precedence over --check.
sh
yerd list php                 # installed versions, from cache (no network)
yerd list php --check         # installed versions, freshly checking for updates
yerd list php --available     # everything installable, tagging what you have

Installed versions are printed one per line; the current default is marked (default), and any version with a newer release shows update available: <installed> -> <latest>. If nothing is installed, yerd list php suggests yerd install php <default>.

Global PHP ini settings

set and unset manage global PHP ini defaults that are applied to every installed version. set writes a value; unset resets a setting back to PHP's built-in default (the wire convention is an empty value).

CommandDescriptionExample
yerd set php <SETTING> <VALUE>Set a global PHP ini default applied to every installed version.yerd set php memory_limit 512M
yerd unset php <SETTING>Reset a global PHP ini default to PHP's built-in value.yerd unset php memory_limit
sh
yerd set php memory_limit 512M
yerd set php display_errors On
yerd unset php memory_limit

The setting name (and, for set, the value) is validated client-side before connecting, so a typo or an out-of-shape value is a clean usage error rather than a round-trip. The supported settings are:

SettingShape
memory_limitbyte size (e.g. 512M), or -1 for unlimited
max_execution_timeinteger
max_input_timeinteger
max_file_uploadsinteger
upload_max_filesizebyte size (e.g. 64M)
post_max_sizebyte size (e.g. 64M)
display_errorsboolean flag (e.g. On / Off)
error_reportingan error_reporting expression

TIP

The configured settings are echoed back by yerd list php under a settings: block, so you can confirm what's currently applied. See the Configuration Reference for how these are stored and rendered into FPM config.

A Forjed project. Released under the MIT License.