Skip to content

PHP Runtime Manager

PAM brings its own PHP. You do not install PHP, compile extensions or keep a system php binary in sync with production: every PAM release embeds one exact PHP build, with its php.ini, its extensions and its version, and every PAM command uses that build. Native and Desktop targets inherit their PHP from PAM too, through a pinned runtime catalog.

This page shows where that runtime lives, how to configure it, and how mobile projects pin a PHP series.

Each PAM release is installed into its own versioned directory, and pam on your PATH points to the active one:

~/.local/share/pam/v2.2.27-linux-x86_64/
├── bin/ pam and its launcher
├── etc/
│ ├── php.ini PAM's base PHP settings
│ └── conf.d/ one .ini file per bundled extension
├── lib/ libphp and private shared libraries
└── share/

Several releases can sit side by side; pam self-update installs the next one and switches the link. Because each directory is complete, a project never runs against a half-upgraded runtime.

Ask PAM which PHP it embeds with pam inspect, or validate the whole setup with pam doctor:

Terminal window
pam doctor
PAM / SYSTEM DIAGNOSTICS
────────────────────────────────────────────────────────────
● [ok] PHP Embed version: 8.5.13
◆ [info] Embed SAPI: embed
◆ [info] Zend Engine: 4.5.13
◆ [info] Embed php.ini: ~/.local/share/pam/v2.2.27-linux-x86_64/etc/php.ini
◆ [info] Embed scanned INI files: 38
◆ [info] Xdebug=false · OPcache=true

(Output trimmed.) The PHP build is non-thread-safe ("zts": false in pam inspect), 64-bit, with OPcache enabled.

The bundled php.ini is intentionally short and production-oriented:

etc/php.ini
expose_php=Off
display_errors=Off
log_errors=On
variables_order=GPCS
zend.assertions=-1

Everything else uses PHP’s defaults (for example memory_limit=128M). In server mode PAM also keeps display_errors off and log_errors on, unless you enable the exposeErrors listen option, so warnings never leak file paths into responses.

The release ships 57 extensions, including bcmath, curl, dom, gd, intl, mbstring, mysqli, PDO with pdo_mysql, pdo_pgsql and pdo_sqlite, pgsql, sodium, sockets, xml, zip and Zend OPcache. List the exact set of your release:

Terminal window
pam -r 'echo implode(PHP_EOL, get_loaded_extensions()), PHP_EOL;'

pam accepts the familiar PHP CLI flags before the script name:

Flag Effect
-d name=value Set an INI directive (repeatable)
-c path Use another php.ini file
-n Ignore every php.ini and the conf.d directory
-r code Run inline code
Terminal window
pam -d memory_limit=256M -d opcache.jit=tracing index.php
pam -r 'echo ini_get("memory_limit"), PHP_EOL;'

-n loads only the extensions compiled into the binary (19 instead of 57), which is useful to prove which extensions your code really needs.

By default every bundled extension is loaded. In production you can load an explicit allowlist instead, which shortens boot and reduces the attack surface:

Terminal window
pam start index.php --workers 8 --php-extension pdo --php-extension tokenizer

With at least one --php-extension, PAM stops scanning conf.d and loads only the listed extensions. pam extensions derives that list from your locked Composer requirements; see Composer Integration.

PAM embeds PHP 8.5 by default. That is a product rule, not just the newest entry of a test matrix:

  • official PAM runtime artifacts embed PHP 8.5;
  • pam init projects and the official skeleton require php: ^8.5;
  • release, container, security and compatibility workflows build against PHP 8.5.

PHP 8.4 remains available as an explicit compatibility choice for Native runtimes while it is maintained. Patch releases inside the 8.5 series ship with regular PAM releases; moving the default to a new series would be a deliberate, documented runtime release.

Mobile and desktop apps cannot download PHP from the system, so PAM resolves their runtime from a signed-off runtime catalog (runtime/catalog.json in the PAM distribution). Each catalog entry pins:

  • the official php.net source URL and its SHA-256;
  • the Android API level, NDK version and minimum iOS version;
  • the extension set compiled into the mobile runtime;
  • a PAM runtime revision.

At the time of writing the catalog offers two channels:

Series Runtime ID Extensions
8.5 (default) 8.5.12-r1 ctype, filter, opcache, phar, session, tokenizer, uri
8.4 8.4.27-r1 ctype, filter, phar, session, tokenizer

Runtime IDs follow <php-version>-r<revision>. A PHP security update changes the PHP version and resets the revision to 1. A PAM portability patch, build flag or packaging fix only increments the revision. 8.5.12-r1 means “the first PAM build of the verified official PHP 8.5.12 source”.

A PAM Native project declares its series in pam-native.json:

pam-native.json
{
"runtime": {
"php": "8.5",
"channel": "stable"
}
}

The PAM Native package adds commands to manage it. They default to the current project:

Terminal window
pam mobile runtime:list # catalog channels, the selected one marked with *
pam mobile runtime:use 8.5 # write the series to pam-native.json and lock it
pam mobile runtime:info # the resolved runtime, NDK and extensions
pam mobile runtime:update # re-resolve the series and rewrite the lock

The resolution is written to .pam-native/runtime.lock.json. Release builds read that lock instead of resolving “latest” at build time, so the same commit always builds against the same PHP.

  • Commit pam-native.json, and keep .pam-native/runtime.lock.json as a CI or release artifact.
  • PAM release automation rebuilds every supported Android ABI from the verified source and publishes the runtimes with build provenance.
  • Native and Desktop packages never bundle a second PHP toolchain of their own; runtime fixes go into the central catalog as a new revision.