Managed Simple Service PHP

nine Team Mar 13, 2017
Managed Simple Service PHP

It has been estimated that up to 80% of the top 10 million websites are using PHP as their server-side language. Considering this, the Managed Simple Service PHP is a very important piece of the Managed (V)Servers at nine.ch. But the service comes in a lot of different shapes and forms. This article should give you an overview.

Versions

For the Managed Simple Service PHP are different versions and configurations available, depending on the Ubuntu version (as of January 2017):

Ubuntu Version Trusty (14.04) Xenial (16.04)
PHP Versionen 5.5 / 5.6 / 7.0 7.0
mod_php (Default)
PHP-FPM available

On Ubuntu 14.04, PHP 5.6 and 7.0 can both be run at once. All other versions have to be configured by nine.ch.

Installation of another PHP version

For consultation and installation of another PHP version, please contact our support using the support request function in our Cockpit or sending an email.

Differences mod_php and PHP-FPM

We operate PHP exclusively together with the Apache webserver. Therefore we have two different interfaces available:

mod_php

The default PHP Apache module is called mod_php. All the PHP code is directly interpreted by the Apache module and is therefore running as the www-data user.

PHP-FPM

PHP-FPM stands for FastCGI Process Manager. FPM interpretes the PHP code and manages its own processes. Apache simply passes the requests to and from FPM.

Pros and Cons

A big advantage of FPM is the increased security it provides when running multiple sites on one server. Each hosting can have its own user and FPM processes. This prevents access from one hosting to another one. Another advantage that comes with it is that multiple PHP versions can be used at the same time. We already support this with Ubuntu 14.04 using PHP 5.6 and PHP 7.0 on the same server. The only real downside of FPM is the complexity of the initial configuration and the monitoring of an additional service.

What is running on my server?

One way to check if PHP-FPM is installed, is by checking dpkg:

www-data@myserver01:~ $ dpkg -l | grep fpm
ii  php5-fpm                                     5.5.9+dfsg-1ubuntu4.19               amd64        server-side, HTML-embedded scripting language (FPM-CGI binary)

On this server PHP-FPM, version 5.5 is installed. If the output of the command remains empty, FPM is not installed. For further questions about the configuration, please contact our support.

Running PHP 5.6 and 7.0 in parallel under Trusty 14.04

As described, we can install PHP with FPM on request. We currently only support this for Ubuntu 14.04 with PHP 5.6 and 7.0. How you can switch between the different versions is described here in our support portal.

Please consider that we rely on an external repository for a parallel installation of PHP 5.6 and PHP 7.0. This repository will provide security updates only until April 2018. Therefore PHP 5.6 and PHP 7.0 can be operated unter Trusyty - according to the current state - for one year before they have to be replaced.

PHP Configuration

Very often there is the need to configure the default PHP settings. Each directive has different modes which determine when and where a PHP directive may or may not be set. A list of all the directives and their modes can be found here.

PHP_INI_SYSTEM

If a directive has the PHP_INI_SYSTEM mode it can only be configured through the nine.ch support. Also, these directives will be set system wide and cannot be customized per hosting.

PHP_INI_ALL/PHP_INI_USER/PHP_INI_PERDIR

All of these directives can be set using a file in the webroot. If the server is using mod_php, this has to be done using the .htaccess file. Here’s an example of how a .htaccess file could look:

php_value memory_limit 512M

If the server is using PHP-FPM, the directives need to be set using a .user.ini file inside the webroot.

memory_limit=512M

If you have any further questions about this topic, please feel free to contact our support team by telephone or email.