All documentation
  1. Home
  2. Docs
  3. PHP

PHP

Every PHP site gets its own FPM pool, running as its own Unix user, confined by open_basedir. Extensions are a curated list, not a free-form package name.

One pool per site

The pool runs as the site's account user with exec disabled unless an administrator turns it on for that site. Verified on the test server: a second site's pool cannot read the first site's files, or /etc/hostname.

The global defaults come from the hardware profile, and every one of them carries the rule that produced it. klyrn profile prints all of them:

pm.max_children = 12
40% of RAM (2370 MB) / 48 MB per worker / 4 busy sites, clamped 4..48

Versions

klyrn php versions              # what is installed
klyrn site set example.com --php 8.3

PHP 8.3 is installed by the installer, from ppa:ondrej/php with a pinned key fingerprint. Other versions from the same PPA can be installed by hand; KLYRN configures one it has not seen before (writing its klyrn-global.conf) before it moves a live site onto it, rather than pointing a site at an unconfigured runtime.

Changing a version removes the old pool before creating the new one, because both write the same socket path. If the new pool will not start, the old one is restored. See Changing a site.

Per-site settings

klyrn site set example.com \
  --memory-limit 512M \
  --upload-max 64M \
  --post-max 64M \
  --max-execution 120 \
  --max-input-time 120 \
  --max-input-vars 3000

klyrn site set example.com --display-errors   # development only
klyrn site set example.com --reset-php        # clear them all

Values are validated, not passed through. Memory up to 4096 MB, uploads up to 2048 MB, execution time up to 3600 seconds, input time between −1 and 3600, input vars between 100 and 100000. Sizes are digits with an optional K, M or G; a value in kilobytes rounds up to 1 MB.

Setting an upload limit larger than the post limit is refused and says why: uploads that big would be rejected anyway, and a limit that does not do what it says is worse than no limit.

Extensions

klyrn php extensions                    # every version, every catalogue entry and its state
klyrn php extensions --version 8.3 --all
klyrn php enable redis --version 8.3
klyrn php disable xdebug --version 8.3

There is no field anywhere in KLYRN where you type a package name. The only names that exist are the 22 catalogue keys, and the package installed is php<version>-<key>:

mysql · curl · mbstring · xml · gd · imagick · intl · zip · bcmath · gmp · soap · opcache · apcu · redis · memcached · mongodb · pgsql · sqlite3 · ldap · ssh2 · imap · xdebug

State is read from php -m and the packaging, never guessed, and the lookup folds case: php -m prints whatever casing the extension author chose, so SimpleXML and Zend OPcache are matched correctly rather than reported as switched off.

Four states are reported: builtin, enabled, disabled, available.

What happens when you change one

An extension is installed once for the whole machine and loaded into every site's PHP worker, so turning one on is an administrator action and it is a job with four steps: install, module, reload, verify.

  1. installOnly when enabling, and only the catalogue's own package name.
  2. modulephpenmod or phpdismod.
  3. reloadphp-fpm must accept the configuration first. If the reload fails, the module is put back the way it was. Entries marked as needing a restart get a real restart, and the panel says so, because a restart drops requests that are in flight.
  4. verifyphp -m is read again through the running pool. If the change did not take, it is undone.

mysql, curl, mbstring and xml are marked required and cannot be turned off: the websites KLYRN creates do not run without them.