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:
| Source | Used on | Notes |
|---|---|---|
| System PHP (OS AppStream) | All servers | Becomes the server's default version. The same version from Remi is ignored. |
| Remi | Servers without CloudLinux | PHP-FPM for current versions, side by side. |
| LiteSpeed (lsphp) | OpenLiteSpeed mode | lsphp for current versions. |
MoorCP (moorcp-php-legacy repo) | Servers without CloudLinux | PHP 5.6–7.3 builds for EL9, because Remi and LiteSpeed do not publish them. |
| CloudLinux alt-php | CloudLinux servers | Managed through PHP Selector. See PHP Selector. |
Runtime type per web server mode:
| Runtime | Web server mode |
|---|---|
| PHP-FPM | nginx-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
- On the version's row, click Install.
- 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.
- 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
- Click Remove on the version's row.
- 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.
| SAPI | Packages shown |
|---|---|
| Remi PHP-FPM | phpXY-php-*, including PECL |
| System PHP-FPM | php-* from AppStream and php-pecl-* from EPEL |
| lsphp | lsphpXY-* from the LiteSpeed repository |
| lsphp, bridged from Remi | Extensions 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.3 | moorcp-phpXY-<extension>, one list for PHP-FPM and lsphp |
To make changes:
- Search for an extension, or filter Installed, Not installed, or PECL.
- Tick extensions to install, untick them to remove.
- 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
pdothatmysqlndneeds. - 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:
| Package | Contents |
|---|---|
pgsql | pgsql, pdo_pgsql |
ldap | ldap |
imap | imap |
tidy | tidy |
redis | PECL redis |
memcached | PECL memcached |
apcu | PECL APCu |
imagick | PECL imagick |
ioncube | ionCube 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.
| Directive | Limit |
|---|---|
memory_limit | At most the package RAM limit, 1024M at most. Applications cannot change it. |
upload_max_filesize, post_max_size | At most 1024M |
max_execution_time, max_input_time | At most 300 |
max_input_vars | At most 20000 |
session.gc_maxlifetime | At most 86400 |
display_errors, short_open_tag, allow_url_fopen, zlib.output_compression, brotli.output_compression | On/Off. brotli.output_compression needs the brotli extension. |
error_reporting, output_buffering | List of choices |
date.timezone | A 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.
- Choose the PHP versions to install.
- 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.
- 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.
