Change of PHP settings in different modes

From ISPWiki
Jump to: navigation, search

Introduction

An administrator of a control panel and its users can change PHP settings. How they will be changed, depends on a User level and PHP mode. In a general case, when an administrator changes PHP settings, they will be applied to all users, provided that a user didn't change the same parameter himself. If the user changed it, admin's changes won't be applied.

CGI (andFastCGI (Apache))

CGI mode (except for alternative CloudLinux versions)

The following files are used for PHP parameters in the "PHP as CGI" mode:

  1. Global (root) php.ini - the main PHP configuration file for a server;
  2. .php.ini - this file containes modified PHP settings;
  3. php.ini - user PHP configuration file;

User files (2 and 3) are located in the ~/php-bin directive for native PHP version, and in ~/php-bin/[PHP version] for alternative PHP versions.

  1. A control panel's user changes PHP settings:
    1. A new value is specified into the .php.ini (2) file
    2. Contents of the user php.ini (3) file is fully changed into global (1) php.ini, therefore user php.ini is a full copy of global php.ini
    3. The system reads settings saved in the .php.ini (2)file and moves them to the user php.ini (3) file, therefore user php.ini is a full copy of global php.ini - php.ini + changes made by the user
  2. A control panel's admin changes PHP settings:
    1. A new value is specified into the global php.ini (1) file
    2. The following actions will be performed for every user:
      1. Contents of the user php.ini (3) file is changed into глобального (1) php.ini , therefore user php.ini is a full copy of global php.ini
      2. The system reads settings saved in the .php.ini (2) file and moves them to the user php.ini (3) file, therefore user php.ini is a full copy of global php.ini - php.ini + changes made by the user
 Note: if you make changes via shell (or via the  "File manager" module):
 1. User php.ini (3) will be overwritten when PHP settings are changed via   ISPmanager, i.e. user changes will get lost.  
 2. .php.ini (2) - modified parameters will be applied only after  PHP parameters are modified via ISPmanager.

If you want to change PHP settings manually, you need to duplicate the changed into both files php.ini and .php.ini.

CGI and LSAPI for CloudLinux alternative versions=

For more information please refer to the article PHP versions on CloudLinux

FastCGI (Nginx + PHP-FPM)

  1. When a user changes PHP settings, they are specified in the PHP-FPM configuration file (of a certain PHP version) of a specific user
  2. Changes made by an administrator are specified into the global configuration file PHP-FPM of a corresponding PHP version

Apache module

  1. A user cannot edit parameters of this PHP mode from the control panel, but in most cases, he can make changes in the .htaccess file
  2. Changes made by aadministrator are specified into the global configuration file of the Apache module of a corresponding PHP version.

Peculiarities of different versions and operating systems

  1. A "global PHP settings file" in alternative PHP versions provided by ISPmanger, and in native PHP version provided by CentOS-based operating systems, is a single file, which contains settings for all PHP modes (/etc/php.ini for the native version on CentOS and /opt/[PHP version ]/etc/php.ini for alternative versions in ISPmanager)
  2. For the native PHP version on Debian-based systems and Ubuntu, a separate "global PHP settings file" is created for every PHP mode (e.g., Debian 8 - /etc/php5/apache2/php.ini, /etc/php5/cgi/php.ini, /etc/php5/fpm/php.ini).