PHP Versions

RunCloud supports multiple PHP versions for different Ubuntu versions. You can choose the PHP version that suits your web application needs and compatibility.

However, not all PHP versions are available for all Ubuntu versions. For example, if you need PHP 7.1, you will have to use Ubuntu 18.04 LTS because it’s not available under Ubuntu 20.04 LTS.

The table below shows the PHP versions that are supported by each Ubuntu version:

PHP/Ubuntu Version16.0418.0420.0422.424.04
PHP 8.3YesYesYes
PHP 8.2YesYesYesYes
PHP 8.1YesYesYesYes
PHP 8.0YesYesYesYes
PHP 7.4YesYesYesYes
PHP 7.3YesYesYes
PHP 7.2YesYesYes
PHP 7.1YesYes
PHP 7.0YesYes
PHP 5.6Yes
PHP 5.5Yes

Naming Convention

Our PHP version naming follows this format:

  • PHP Name: php[VERSION]rc
  • PHP FPM name: php[VERSION]rc-fpm

The VERSION values are 55, 56, 70, 71, 72, 73, 74, 80, 81, 82 and so on depending on the PHP versions 5.5, 5.6, 7.0, 7.1, 7.2, 7.3, 7.4, 8.0, 8.1 and 8.2 respectively.

Basic Command

You don’t have to do any of these commands if you are changing the PHP Config from the RunCloud Panel. However, if you want to manually start, stop, reload, or restart a PHP version, you can use the following commands:

  • Start: systemctl start php[VERSION]rc-fpm
  • Stop: systemctl stop php[VERSION]rc-fpm
  • Reload: systemctl reload php[VERSION]rc-fpm
  • Restart: systemctl restart php[VERSION]rc-fpm
  • Automatically start PHP after server reboot: systemctl enable php[VERSION]rc-fpm
  • Disable PHP automatically starting after reboot: systemctl disable php[VERSION]rc-fpm

For example, if you want to start, stop, reload or restart PHP 7.4, you can use:

  • Start: systemctl start php74rc-fpm
  • Stop: systemctl stop php74rc-fpm
  • Reload: systemctl reload php74rc-fpm
  • Restart: systemctl restart php74rc-fpm
  • Automatically start PHP after server reboot: systemctl enable php74rc-fpm
  • Disable PHP automatically starting after reboot: systemctl disable php74rc-fpm

Or to start, stop, reload or restart PHP 8.1, you can use:

  • Start: systemctl start php81rc-fpm
  • Stop: systemctl stop php81rc-fpm
  • Reload: systemctl reload php81rc-fpm
  • Restart: systemctl restart php81rc-fpm
  • Automatically start PHP after server reboot: systemctl enable php81rc-fpm
  • Disable PHP automatically starting after reboot: systemctl disable php81rc-fpm

Web Application Config

Each of your web applications will have their own PHP config. They are located inside /etc/php[VERSION]rc/fpm.d/.conf

For example, if your web app name is myapp and using PHP 7.4, the config will be located inside /etc/php74rc/fpm.d/myapp.conf.

To view all of the config files across all PHP versions, run:

ls -lah /etc/php*rc/fpm.d/*.conf.

PHP Location

Each PHP version is installed inside its own folder with its own settings folder.

  • Installed location: /RunCloud/Packages/php[VERSION]rc/
  • Config location: /etc/php[VERSION]rc/php.ini

For example:

  1. For PHP 7.4:
    • Installed location: /RunCloud/Packages/php74rc/
    • Config location: /etc/php74rc/php.ini
  2. For PHP 8.0:
    • Installed location: /RunCloud/Packages/php80rc/
    • Config location: /etc/php80rc/php.ini
  3. For PHP 8.1:
    • Installed location: /RunCloud/Packages/php8.1rc/
    • Config location: /etc/php8.1rc/php.ini
  4. For PHP 8.2:
    • Installed location: /RunCloud/Packages/php82rc/
    • Config location: /etc/php82rc/php.ini

Extra PHP-FPM Configuration

Some of the PHP settings that you may want to tweak are not supported by the RunCloud panel. To give you more flexibility, we introduced extra PHP-FPM configurations. This allows you to add custom php.ini settings for each of your web applications.

You can find your extra PHP-FPM configurations inside /etc/php-extra/[app name].conf.

The extra PHP-FPM configuration file follows this format:

; Custom php.ini settings for web application
php_admin_value[key] = value

The key is the php.ini setting that you want to modify, and the value is the value that you want to assign to it. For example, if you want to enable short open tag for your web application, you can use:

; Enable short open tag for web application
php_admin_value[short_open_tag] = On

By default, RunCloud depends on php.ini inside /etc/php*rc/php.ini and overrides it inside /etc/php*rc/fpm.d/*.conf. However, some of the settings cannot be tweaked from the panel and will still rely on php.ini.

Editing php.ini directly is not recommended as this will affect every web application globally. By modifying this file, each of your web applications will get their own exclusive settings.

After you have edited your extra PHP-FPM configuration file, you will need to reload your PHP-FPM service. Refer to the basic commands section above to learn how to do this.

Installing RunCloud Modules

RunCloud provides some additional modules that you can install for your PHP applications. The table below shows the list of modules and their package names:

Module NamePackage NameDescription
imapphp70rc-imap
php71rc-imap
php72rc-imap
php73rc-imap
php74rc-imap
php80rc-imap
php81rc-imap
php82rc-imap
The module to access IMAP. Most probably you are not using this module, unless you have a web application that can read email.
ldapphp70rc-ldap
php71rc-ldap
php72rc-ldap
php73rc-ldap
php74rc-ldap
php80rc-ldap
php81rc-ldap
php82rc-ldap
The module to access LDAP (Lightweight Directory Access Protocol).
geoipphp70rc-pecl-geoip
php71rc-pecl-geoip
php72rc-pecl-geoip
php73rc-pecl-geoip
php74rc-pecl-geoip
The module to work with MaxMind GeoIP. This module does not work with GeoIP2.
imagickphp70rc-pecl-imagick
php71rc-pecl-imagick
php72rc-pecl-imagick
php73rc-pecl-imagick
php74rc-pecl-imagick
php80rc-pecl-imagick
php81rc-pecl-imagick
php82rc-pecl-imagick
The module for image processing using ImageMagick.
mongodbphp70rc-pecl-mongodb
php71rc-pecl-mongodb
php72rc-pecl-mongodb
php73rc-pecl-mongodb
php74rc-pecl-mongodb
php80rc-pecl-mongodb
php81rc-pecl-mongodb
php82rc-pecl-mongodb
MongoDB database driver for PHP.
pgsqlphp70rc-pgsql
php71rc-pgsql
php72rc-pgsql
php73rc-pgsql
php74rc-pgsql
php80rc-pgsql
php81rc-pgsql
php82rc-pgsql
The driver to work with PostgreSQL database.
snmpphp70rc-snmp
php71rc-snmp
php72rc-snmp
php73rc-snmp
php74rc-snmp
php80rc-snmp
php81rc-snmp
php82rc-snmp
The module to manage remote device. Simple Network Management Protocol.
soapphp70rc-soap
php71rc-soap
php72rc-soap
php73rc-soap
php74rc-soap
php80rc-soap
php81rc-soap
php82rc-soap
The module to communicate with SOAP server or to build your own SOAP server.

To install any module, just use the package name as the argument for the apt install command. For example, if you want to install the imagick module for PHP 7.4, you can use:

sudo apt-get install php74rc-pecl-imagick

Note: To install ionCube Loader, please follow this guide inside our blog: How to install ionCube Loader on RunCloud.

Installing Custom PHP Modules

RunCloud provides its own PHP versions that are different from the default ones in Ubuntu. Therefore, you cannot use apt-get install php-* to install PHP modules, because it will conflict with the RunCloud PHP versions.

Instead, you will need to compile and install the PHP modules manually. This may sound complicated, but it is not too difficult if you follow the steps below.

In this example, we will show you how to compile and install the pecl-sphinx module for PHP 5.5 and PHP 5.6 under Ubuntu 16.04 LTS. This module allows you to use the Sphinx search engine with PHP.

You need to log in as a root user to be able to compile and install the module.

  1. Install the required development tools.
apt-get install autoconf libpcre3-dev
  1. Set the module name and version.
MODULE_NAME="sphinx"
MODULE_VERSION="1.3.3"
  1. Download and extract the module source code.
cd ~
wget https://pecl.php.net/get/$MODULE_NAME-$MODULE_VERSION.tgz
tar -zxvf $MODULE_NAME-$MODULE_VERSION.tgz
cd $MODULE_NAME-$MODULE_VERSION
  1. Install the module for PHP 5.5.
# Clean up any previous compilation
/RunCloud/Packages/php55rc/bin/phpize --clean

# Prepare the module for PHP 5.5
/RunCloud/Packages/php55rc/bin/phpize
./configure --with-libdir=lib64 CFLAGS='-O2 -fPIE -fstack-protector-strong -Wformat -Werror=format-security -Wall -pedantic -fsigned-char -fno-strict-aliasing'
 
make install
 
# Enable the module for PHP 5.5
echo "extension=$MODULE_NAME.so" > /etc/php55rc/conf.d/$MODULE_NAME.ini
 
systemctl restart php55rc-fpm

You can use the same steps to install other custom PHP modules, but you may need to change the module name, version, and configuration flags accordingly.

You can also install the module for other PHP versions, but you will need to change the PHP version number in the commands. For example, if you want to install the module for PHP 7.4, you need to use php74rc instead of php55rc.