Docs cipi.yml Web panel API MCP Guides Compare GitHub Telegram channel
  1. Docs
  2. Server & runtime
  3. PHP versions & php.ini

PHP versions & php.ini

Install PHP versions, switch per app and tune php.ini.

Server & runtime

Run several PHP versions side by side, give each app its own, and keep all of them patched. Cipi installs from packages.sury.org (fastest with security releases), then the ondrej PPA, then Ubuntu.

PHP versions
$ cipi php list
$ cipi php install 8.3
$ cipi app edit blog --php=8.5

Versions#

bash
cipi php list                # versions, patch level, security state, default
cipi php install 8.4         # add a version (8.3–8.6)
cipi php switch 8.6          # server default (CLI, panel pools)
cipi php remove 8.1          # refused while it's the default or an app uses it
cipi app edit myapp --php=8.6  # move one app, zero downtime
VersionStatus on Cipi
8.6Default on new servers once the repository has every extension Cipi needs
8.3, 8.4, 8.5Installable and assignable
7.4–8.2 (old servers)Listed, restartable, removable; never offered to an app

Each app's deploys, Composer, cron and workers always use the app's PHP, never the server default.

A new PHP minor#

When a new minor comes out, the extension packages (redis, memcached, imagick) follow a few days later. Cipi handles the gap:

SituationCipi
PHP packaged, some extensions not yetInstalls it, records what's missing, adds each extension as soon as it's published (nightly)
Only a release candidate availableInstalls it and labels it prerelease
Assigning a version still missing extensionsRefused with the list of what's missing; --force if the app doesn't use them
A lock file that rejects the new PHPThe deploy fails and the live release stays: update the dependency, commit, deploy

Security patches#

PHP is excluded from Ubuntu's unattended upgrades: Cipi patches it itself every night at 03:30, restarts only the affected PHP-FPM services and reports the result.

bash
cipi php upgrade      # patch now and print the patch level
StateMeaning
patchedAt or past the latest security release Cipi knows
VULNERABLEA fix exists but isn't installed yet (exit code 1; the nightly job alerts until fixed)
distroUbuntu build: fixes backported without a version bump
END OF LIFENo more fixes from PHP: move apps off it
prereleaseRelease candidate, not compared

Octane apps run the PHP inside their FrankenPHP binary, which apt never touches; cipi php upgrade lists them too and cipi frankenphp upgrade fixes them.

Hardening#

Every pool Cipi writes (apps, webhook receivers, panel) locks down settings that recent PHP advisories used as attack paths, and Octane apps load the same rules:

ini
php_admin_flag[session.upload_progress.enabled] = off
php_admin_flag[fatal_error_backtraces] = off

They are set as admin flags, so neither .user.ini nor ini_set() can turn them back on. Vhosts never enable fastcgi_keep_conn. Real-world walkthrough: How Cipi handles PHP and nginx CVEs.

php.ini settings: cipi ini#

Change PHP settings without hunting for the right file. Server-wide changes reach PHP-FPM and CLI, so web requests, workers, Artisan and cron agree.

bash
cipi ini list [--app=shop]                  # effective values and where each comes from
cipi ini set upload_max_filesize=50M        # server-wide
cipi ini set memory_limit=512M --app=shop   # one app only (wins)
cipi ini unset memory_limit --app=shop
cipi ini reset [--app=shop]
cipi ini keys                               # what can and can't be set
BehaviourWhy
Raising upload_max_filesize raises post_max_size/memory_limit if they'd cap itOne command, a working upload limit
Nginx client_max_body_size flagged when it would cap itNo mystery 413 errors
open_basedir, auto_prepend_file, extension… refusedThey are part of app isolation
Every change fires the ini_set notificationNothing changes on a shared server without a trace

Per-app settings can also live in cipi.yml as app.ini.

Common problems#

ProblemFix
Assigning a version is refusedAn extension isn't published yet for it: the message lists which; --force if unused
VULNERABLE in cipi php listRun cipi php upgrade now
Wrong php -v in the shellThat's the server default; apps use their own

Questions#

QuestionAnswer
Can apps use different versions?Yes, each app has its own.
How do I upgrade an app?Upgrade PHP without downtime.