Documentation

Didn't know where to start? Here we have something might be useful.

PHP

Naming convention

Our PHP version naming depending on the name shown below

# PHP Name
php[VERSION]rc

# PHP FPM name
php[VERSION]rc-fpm

The VERSION are 55, 56, 70, 71, 72 and so on depending on php version 5.5, 5.6, 7.0, 7.1 and 7.2 respectively.

Basic command

You don't have to do any of this command if you are changing PHP Config from RunCloud Panel

If you would like to start, stop, reload or restart php7.0, you may use,

# Start
systemctl start php70rc-fpm

# Stop
systemctl stop php70rc-fpm

# Reload
systemctl reload php70rc-fpm

# Restart
systemctl restart php70rc-fpm

# Automatically start php after server reboot
systemctl enable php70rc-fpm

# Disable php automatic start after reboot
systemctl disable php70rc-fpm

Or to start, stop, reload or restart php7.1, you can use

# Start
systemctl start php71rc-fpm

# Stop
systemctl stop php71rc-fpm

# Reload
systemctl reload php71rc-fpm

# Restart
systemctl restart php71rc-fpm

# Automatically start php after server reboot
systemctl enable php71rc-fpm

# Disable php automatic start after reboot
systemctl disable php71rc-fpm

Web application location

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

# If your web app name is myapp and using php7.0, the config will be located inside
/etc/php70rc/fpm.d/myapp.conf

PHP location

Each PHP were installed inside their own folder with their own setting folder

# Installed location
/RunCloud/Packages/php[VERSION]rc/

# Config location
/etc/php[VERSION]rc/php.ini


# Example
/RunCloud/Packages/php55rc/ # Installed location
/etc/php55rc/php.ini # Config location

/RunCloud/Packages/php56rc/ # Installed location
/etc/php56rc/php.ini # Config location

/RunCloud/Packages/php70rc/ # Installed location
/etc/php70rc/php.ini # Config location

/RunCloud/Packages/php71rc/ # Installed location
/etc/php71rc/php.ini # Config location

/RunCloud/Packages/php72rc/ # Installed location
/etc/php72rc/php.ini # Config location

Extra PHP-FPM configuration

While most of the config can be tweaked from the panel, some of it isn’t supported out of the box. To give you freedom, we introduced extra PHP-FPM configuration.

You can find your extra PHP-FPM configuration inside /etc/php-extra/<web_application_name>.conf.

What you can do with it is that you can add php.ini tweak here. By default, RunCloud depends on php.ini inside /etc/php<version>rc/php.ini and overwrite it inside /etc/php<version>rc/fpm.d/<web_application_name>.conf. But some of the config isn’t supported to be tweak from the panel and will still be rely on php.ini. By modifying /etc/php<version>rc/fpm.d/<web_application_name>.conf, each of your web application will get their own exclusive settings. Editing php.ini is a no-no and will affect every web application globally unless you know what you are doing.

Below example will show you how to use extra fpm configuration.

; Inside php.ini, there is a setting to enable php short tag.
; Instead of writing <?php you can write <? and php will execute.
; The default value is disabled.
; To turn it on globally, you can just edit php.ini
short_open_tag = On

But if you are not going to use this globally, you should add it inside extra php-fpm configuration. For example, my Web Application name is awesomephp. The extra configuration file will be located inside /etc/php-extra/awesomephp.conf. Edit the file by using configuration below and save it.

; This will be exclusive to awesomephp Web Application only
php_admin_value[short_open_tag] = On

The setting style is clear. You take whatever key you wanted to modified inside php.ini, wrap it with php_admin_value and assign the value you wanted to overwrite.

php_admin_value[key] = value

After you have edited your PHP-FPM extra configuration file, reload your PHP-FPM

# systemctl reload php<version>rc-fpm
# If you are using PHP 7.1 for awesomephp Web Application
systemctl reload php71rc-fpm

This idea was coming from our customers who are using Wordfence plugin for WordPress. We also have dedicated post for this inside our blog, Wordfence Integration with PHP-FPM inside RunCloud.

ionCube loader

To install ionCube Loader, please follow this guide inside our blog.

Zend Guard loader

To install Zend Guard Loader, please follow this guide inside our blog.

Installing modules

This is the list of extra module if you want to use it:

Module Name Package Name Description
imap php55rc-imap
php56rc-imap
php70rc-imap
php71rc-imap
php72rc-imap
The module to access IMAP. Most probably you are not using this module, unless you have a Web Application that can read email.
ldap php55rc-ldap
php56rc-ldap
php70rc-ldap
php71rc-ldap
php72rc-ldap
The module to access LDAP (Lightweight Directory Access Protocol).
geoip php55rc-pecl-geoip
php56rc-pecl-geoip
php70rc-pecl-geoip
php71rc-pecl-geoip
php72rc-pecl-geoip
The module to work with MaxMix GeoIP. This module does not work with GeoIP2.
imagick php55rc-pecl-imagick
php56rc-pecl-imagick
php70rc-pecl-imagick
php71rc-pecl-imagick
php72rc-pecl-imagick
The module for image processing using ImageMagick.
mongodb php55rc-pecl-mongodb
php56rc-pecl-mongodb
php70rc-pecl-mongodb
php71rc-pecl-mongodb
php72rc-pecl-mongodb
MongoDB database driver for PHP.
pgsql php55rc-pgsql
php56rc-pgsql
php70rc-pgsql
php71rc-pgsql
The driver to work with PgSQL Database.
snmp php55rc-snmp
php56rc-snmp
php70rc-snmp
php71rc-snmp
php72rc-snmp
The module to manage remote device. Simple Network Management Protocol.
soap php55rc-soap
php56rc-soap
php70rc-soap
php71rc-soap
php72rc-soap
The module to communicate with SOAP server or to built your own SOAP server.
# To install any module, just use the module name
# This example will install soap module to php5.5, php5.6, php7.0, php7.1 php7.2
apt-get install php55rc-soap php56rc-soap php70rc-soap php71rc-soap php72rc-soap

# Then reload the php
systemctl reload php55rc-fpm
systemctl reload php56rc-fpm
systemctl reload php70rc-fpm
systemctl reload php71rc-fpm
systemctl reload php72rc-fpm

Installing custom PHP modules

Since we are rolling our own PHP Version, apt-get install php-* won’t work because it will replace our php and there will be a conflict. Thus, you need to compile your own modules to make it work. Don’t worry about it because most modules already shipped with RunCloud except you are trying to do some weird things inside your server.

This example will teach you how to compile pecl-sphinx inside your RunCloud Server.

You need to login as root user to be able to compile and install the module.

# Install the required developement tools
apt-get install autoconf libpcre3-dev

# Set module name
MODULE_NAME="sphinx"

# Set download version
MODULE_VERSION="1.3.3"

# Download & Extract
cd ~
wget https://pecl.php.net/get/$MODULE_NAME-$MODULE_VERSION.tgz
tar -zxvf $MODULE_NAME-$MODULE_VERSION.tgz
cd $MODULE_NAME-$MODULE_VERSION


# Installing for PHP5.5
# make clean will always fail if you never compile it before
make clean

/RunCloud/Packages/php55rc/bin/phpize --clean

/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

echo "extension=$MODULE_NAME.so" > /etc/php55rc/conf.d/$MODULE_NAME.ini

systemctl restart php55rc-fpm


# Installing for PHP5.6
# make clean will always fail if you never compile it before
make clean

/RunCloud/Packages/php56rc/bin/phpize --clean

/RunCloud/Packages/php56rc/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

echo "extension=$MODULE_NAME.so" > /etc/php56rc/conf.d/$MODULE_NAME.ini

systemctl restart php56rc-fpm