Websites
PHP versions, settings and PHP-FPM
Run PHP 5.6 to 8.5 side by side, choose a version and php.ini values per domain, tune PHP-FPM per subscription, watch OPcache, add extensions or ionCube, and update a PHP version as one unit.
On this page
Berth runs several PHP versions next to each other and lets every domain pick its own. Each subscription gets its own PHP-FPM, so one busy or broken site cannot starve the others. This article covers versions, per-domain settings, the FPM process model, OPcache, extensions and how PHP is kept up to date.
Supported versions
PHP 5.6 up to 8.5 can be installed. Packages come from the established third-party repositories: Sury on Debian and Ubuntu, Remi on AlmaLinux and Rocky Linux.
Versions that no longer receive security fixes (such as 7.4, 8.0 and 8.1) stay available, so an old site can move to Berth first and be upgraded afterwards. The panel marks them as outdated, shows the date of the last security fix, and warns on the domain page and in the site quality score.
Add or remove a version
An administrator manages versions under System → Software, or on the command line:
berth php version list # installed and available versions, end of support, who uses them
berth php version add 8.4
berth php version remove 7.4 # refused while a domain, package, webmail or Adminer still uses itAdding a version runs as a system job with its own live log. If someone installs a PHP version by hand outside the panel (for example apt install php8.4-fpm), Berth detects it and offers Adopt PHP 8.4. It never assigns such a version to a domain by itself.
Choose the PHP version of a domain
On the domain page, open Settings → PHP, pick the version and save. An empty choice follows the package default.
berth domain php --domain example.com --version 8.3
berth domain php --domain example.com --version "" # back to the package defaultTo move many domains at once, use Domains → Several at once or berth domain bulk --action php --value 8.4 --domains ….
php.ini per domain
Under the same PHP section you set php.ini values for one website. An empty field follows the package. Typical keys:
| Setting | Example |
|---|---|
memory_limit | 256M |
upload_max_filesize, post_max_size | 64M |
max_execution_time, max_input_time | 60 |
max_input_vars | 3000 |
date.timezone | Europe/Amsterdam |
session.gc_maxlifetime | 1440 |
error_reporting | E_ALL & ~E_DEPRECATED |
display_errors, log_errors, short_open_tag, OPcache, allow_url_fopen | on or off |
A .user.ini in the website is honoured as well.
Defaults and locking in the package
The package sets the defaults for every domain on it:
berth plan set --name basis --php 8.3 \
--php-setting memory_limit=256M --php-setting upload_max_filesize=64M
berth plan set --name managed --php 8.3 --php-lockedWith PHP settings locked (--php-locked) customers can no longer change the PHP version or php.ini of their domains; the administrator still can. For a single subscription, deviate from the package with an override:
berth subscription override --sysuser acme --php memory_limit=512M
berth subscription override --sysuser acme --set php_version=8.4Hard limits from the server policy
A hosting company may want limits that no package, override or panel action can loosen, for example a maximum memory_limit or an allow-list of PHP versions. Those live in the root-only server policy (berth beleid), described in Web server settings.
PHP-FPM per subscription
Every subscription runs its own PHP-FPM master per PHP version, inside the subscription's systemd slice. Its processes run as the subscription's system user and count towards its CPU, memory and task limits. An idle pool costs very little memory. On servers with many small sites, the option Only packages with limits keeps the own FPM for packages that have resource limits and lets the rest share an FPM per version.
The pools are rendered and tested by the root agent itself from a typed specification, and a reload never cuts off running requests: requests in flight may finish, new ones wait briefly in the queue. See How changes go live.
Process model
| Model | When to use it |
|---|---|
ondemand (default) | Most sites. Processes start when requests arrive and stop when idle. |
dynamic | Busy sites that benefit from a few processes kept warm. |
static | A fixed number of processes; for predictable, heavy load. |
The package sets the model and the maximum number of PHP processes per domain. An administrator can deviate per domain under Speed → PHP processes:
berth plan set --name basis --fpm-pm ondemand --fpm-max-children 5
berth domain fpm --domain example.com --pm dynamic --max-children 12
berth domain fpm --domain example.com --resetThe same section shows how many processes are busy, the peak since the last start, memory use and slow requests, with advice when the pool was full. A slow request log is kept per domain; open it from the section or with berth domain logs --domain example.com --kind php_slow.
OPcache dashboard
Admin → PHP shows, per PHP version, the occupancy of every pool (full pools, slow requests) and the OPcache state: memory used, cached files, interned strings, hit rate, with advice when the cache is too small. OPcache memory, the number of files, interned strings and JIT are configurable per version:
berth php status
berth php opcache --version 8.3 --memory 256 --files 20000 --jit --jit-buffer 64Because OPcache is shared by the sites on one PHP version, functions such as opcache_reset() and opcache_get_status() are not available to websites. PHP picks up new code by itself after an upload.
Extensions and ionCube
Extra PHP extensions, such as apcu, are added per version under System → Software → PHP 8.3. Only extensions from Berth's built-in list for the operating system are offered.
berth php ext add 8.3 apcu
berth php ext remove 8.3 apcuSites encrypted with ionCube need the ionCube Loader. Berth downloads it only from ionCube over HTTPS, checks it against a SHA-256 you supply (or pins the hash of what ionCube delivers now), test-loads it, and enables it as the first Zend extension, followed by a config test and a PHP-FPM reload:
berth php ioncube install 8.3 --accept-license --sha256 <hash>
berth php ioncube status 8.3The loader is covered by ionCube's own licence; --accept-license confirms you have read it. Extension and ionCube changes reload PHP-FPM, including the own FPMs of every subscription on that version.
Hardening defaults
Every pool starts hardened. The defaults are:
open_basedirlimited to the subscription's home,security.limit_extensionsset to.php,- process functions (
exec,system,proc_openand similar) and the OPcache control functions disabled, mail()off in new packages: a hacked site cannot send spam through it, andmail()returnsfalse. Sites send mail over SMTP with a mailbox instead (WP Mail SMTP, PHPMailer),expose_phpoff, hardened session cookies,- each subscription's FPM with its own
/tmp: the webspace'stmp/folder, which counts towards the subscription's disk space; other processes on the server are hidden.
Two package switches relax this when a site really needs it:
| Package option | Effect |
|---|---|
Allow PHP mail() (--php-mail) | PHP may send with mail(), within an hourly recipient budget per subscription |
PHP may start processes (--php-shell) | Process functions are allowed |
Hidden files such as .env, .git and .htaccess, and the private folders of web shops, are never served to visitors; .well-known is.
Updating PHP as one unit
The automatic security updates include PHP from Sury or Remi, within a version only patch releases. All packages of one PHP version (fpm, cli, common and the extensions) always move together: System → Updates shows one line per version, for example "PHP 8.3: 8.3.26 → 8.3.27, 15 packages", with Update PHP 8.3. The update runs with a check before and after; if the check fails, all packages go back together. The check afterwards requests every site on the updated version again: a site that worked before the update and now returns a server error makes the update count as failed. See OS updates and maintenance and every site is watched for server errors.
Related
- Domains and subscriptions
- Isolation for slices, quotas and outbound traffic
- Software installer for WordPress and other PHP applications
- Customers and packages