Skip to content

PHP versions ​

This page explains how to install and remove PHP versions on a server, manage extension packages, and the php.ini limits that apply to clients. It is written for admins and technicians.

MoorCP supports PHP 5.6 up to the latest release on one server. Each website can use a different version.

PHP sources ​

The agent detects installed PHP versions from several sources:

SourceUsed onNotes
System PHP (OS AppStream)All serversBecomes the server's default version. The same version from Remi is ignored.
RemiServers without CloudLinuxPHP-FPM for current versions, side by side.
LiteSpeed (lsphp)OpenLiteSpeed modelsphp for current versions.
MoorCP (moorcp-php-legacy repo)Servers without CloudLinuxPHP 5.6–7.3 builds for EL9, because Remi and LiteSpeed do not publish them.
CloudLinux alt-phpCloudLinux serversManaged through PHP Selector. See PHP Selector.

Runtime type per web server mode:

RuntimeWeb server mode
PHP-FPMnginx-proxy, nginx, apache
LSAPI (lsphp)openlitespeed

PHP versions page ​

Open Servers › (server) › Settings › PHP versions, or Actions › PHP versions in the server's details.

The table shows PHP 5.6 up to the highest version the repositories offer. The list is read from repository metadata, so new versions appear on their own as soon as a repository publishes them. Click Check repositories to refresh the metadata.

Each version shows:

  • its status: Installed, Available, or Not in repos;
  • Source: Remi, LiteSpeed, MoorCP, system, or alt-php;
  • PHP-FPM and LSAPI (lsphp) status;
  • the support date from php.net (Supported until), or an EOL mark;
  • the number of Websites using that version;
  • Preview for preview releases (RC).

Filter the table by Status, Source, and SAPI, or search for a version.

Installing a PHP version ​

  1. On the version's row, click Install.
  2. Choose the SAPIs to install:
    • PHP-FPM (Remi) for Nginx/Apache modes;
    • lsphp (LiteSpeed) for OpenLiteSpeed mode. Ticked automatically when OpenLiteSpeed is installed;
    • for 5.6–7.3, a single MoorCP package contains both PHP-FPM and lsphp.
  3. Read any warnings, then confirm.

The agent sets up the required repository, then installs the runtime with common extensions: mysqlnd, gd, mbstring, xml, intl, opcache, pdo, process, soap, bcmath, sodium, and zip. Extensions that are not available for that version are skipped. The install can take a few minutes.

An installed version can be chosen by clients for their websites right away.

EOL and RC versions

  • Versions 5.6–7.3 are EOL and no longer get security fixes. Once installed, they can be chosen by every account on the server. Install them only on servers that actually serve legacy applications.
  • Preview releases (RC) are for testing only.

Removing a PHP version ​

  1. Click Remove on the version's row.
  2. Confirm.

Removal is refused when:

  • the version is still used by websites (Used by websites). Move those websites to another version first;
  • the version is the server's default version or the system PHP (Default version).

Extension packages ​

The Extensions button appears on installed versions. Its window has PHP-FPM and LSAPI (lsphp) tabs when both are installed.

SAPIPackages shown
Remi PHP-FPMphpXY-php-*, including PECL
System PHP-FPMphp-* from AppStream and php-pecl-* from EPEL
lsphplsphpXY-* from the LiteSpeed repository
lsphp, bridged from RemiExtensions the LiteSpeed repository does not have, currently brotli, from the Remi package phpXY-php-<name> of the same version. Marked from Remi.
MoorCP 5.6–7.3moorcp-phpXY-<extension>, one list for PHP-FPM and lsphp

To make changes:

  1. Search for an extension, or filter Installed, Not installed, or PECL.
  2. Tick extensions to install, untick them to remove.
  3. Click Apply changes.

What happens:

  • Repository metadata is refreshed every time the list opens, so new packages show up right away.
  • New extensions are enabled for every account using that version. Accounts that turned an extension off keep it off.
  • PHP of the accounts using that version is restarted. The count is shown when done.

Limits:

  • Core packages (cli, fpm, common) are locked.
  • Packages required by other packages are refused, for example removing pdo that mysqlnd needs.
  • Development packages (-devel, -debugsource) are not shown.

Brotli for lsphp ​

The LiteSpeed repository has no lsphpXY-brotli package. The lsphp list still offers brotli, marked from Remi. Installing it installs the Remi package phpXY-php-brotli of the same PHP version, checks that lsphp can load the module, then enables it for lsphp and the accounts on that version. Removing it only turns it off for lsphp. The Remi package stays, because PHP-FPM may use it.

With the extension installed, a client can turn on brotli.output_compression in the PHP settings so PHP pages are sent with brotli to browsers that support it. In OpenLiteSpeed mode, the account's vhost then gets a rule that stops OpenLiteSpeed from adding gzip on top. See Web server modes › openlitespeed.

PHP 5.6–7.3 extensions from MoorCP ​

MoorCP builds include about 50 built-in extensions that are always on, including bcmath, curl, gd, intl, mbstring, mysqli, openssl, PDO, soap, and zip. OPcache is a separate extension. Extra packages you can install:

PackageContents
pgsqlpgsql, pdo_pgsql
ldapldap
imapimap
tidytidy
redisPECL redis
memcachedPECL memcached
apcuPECL APCu
imagickPECL imagick
ioncubeionCube Loader

Per-account PHP pools ​

Each account has one PHP-FPM process for each PHP version its websites use. The maximum number of processes per pool follows the package's Entry Processes limit. Pools for versions no longer in use are removed automatically when vhosts are applied.

In OpenLiteSpeed mode the structure is the same, with lsphp per account per version. How long an idle lsphp process stays (LSAPI_MAX_IDLE, default 30 seconds) and LSAPI_AVOID_FORK are set for all accounts at once in the server's OpenLiteSpeed settings. See Web server modes › OpenLiteSpeed settings.

Websites on a version that is not installed

A website whose version is not installed, for example a cPanel migration on PHP 5.6, keeps running on the server's default version. The panel marks it as a fallback. Install the original version if the application needs it.

PHP versions and packages ​

Packages do not need to list PHP versions. Every version installed on the account's server is available to the client, including EOL versions and CloudLinux alt-php. EOL versions are marked EOL in the client panel.

To restrict the versions for a specific package, set its list of allowed versions through the packages API. The server's default version is always allowed. See Packages.

php.ini limits for clients ​

Clients can change some php.ini directives themselves. These settings apply to all of the account's PHP versions.

DirectiveLimit
memory_limitAt most the package RAM limit, 1024M at most. Applications cannot change it.
upload_max_filesize, post_max_sizeAt most 1024M
max_execution_time, max_input_timeAt most 300
max_input_varsAt most 20000
session.gc_maxlifetimeAt most 86400
display_errors, short_open_tag, allow_url_fopen, zlib.output_compression, brotli.output_compressionOn/Off. brotli.output_compression needs the brotli extension.
error_reporting, output_bufferingList of choices
date.timezoneA valid time zone

Panel security settings (open_basedir, disable_functions, allow_url_include, error logging) cannot be changed by clients.

The default php.ini for all pools on the server (uploads, execution time, time zone, OPcache) is set through the "PHP: default php.ini" target in Service configuration or Config profiles.

PHP Selector on CloudLinux ​

On CloudLinux servers you can use PHP Selector. Websites are served by Apache + mod_lsapi instead of PHP-FPM. Each account picks its own alt-php version, extensions, and php.ini options from the client panel. The choice applies to all of the account's websites and takes effect right away without a restart.

PHP Selector is only supported in the apache and nginx-proxy web server modes, because mod_lsapi runs in Apache.

Installing and enabling ​

The PHP Selector card is in the CloudLinux tab of the server's details.

  1. Choose the PHP versions to install.
  2. Click Install PHP Selector. The agent installs mod_lsapi, mod_hostinglimits, and the chosen alt-php versions, then restarts Apache. The download can take 10 to 30 minutes. Websites do not change at this stage.
  3. Click Enable PHP Selector for websites. The vhosts of all websites are re-rendered in the background. Every account starts on native PHP until the user picks a version.

To add versions later, click Install more PHP versions.

To go back to PHP-FPM, click Switch back to PHP-FPM. Users' PHP Selector choices no longer apply.

WARNING

While PHP Selector is active, per-website PHP version settings (PHP-FPM) do not apply. The server default and global alt-php extensions are set in CloudLinux Manager › PHP Selector.

See also ​

MoorCP Shared, a shared hosting panel for server fleets.