ISPmanager 6 Lite, Pro, Host Documentation

PHP settings

ISPSystem

PHP has many settings that can be edited by an ISPmanager Administrator or User. The set of values depends on the operating mode. In the "CGI", "FastCGI (Apache)" operating modes, the user values are used, in the "Apache Module" mode - the values specified by the administrator. If the user did not change the value of the parameter, the value specified by the administrator will be used instead of the user value of the variable.

"FastCGI (Nginx + PHP-FPM)", "CGI", "FastCGI (Apache)" modes use three levels of settings: administrator settings, user settings, and website settings. Website settings have the highest priority. If the value of the parameter for the website has not been changed, ISPmanager uses the user settings. If the user did not change the value of the parameter, ISPmanager will use the value specified by the administrator.

Variable values are displayed in different colors: 

  • Red — the values for these parameters are not defined in the PHP configuration file and have been received from the PHP interpreter.
  • Green — the values for these parameters are defined in the global PHP configuration file for an administrator and in the user configuration file for a user. 
  • Blue — the values for these parameters are not defined.
  • Yellow — read-only values (for users).

Editing variables


Perform the following steps to edit a variable: 

  1. Log in as an administrator and go to Web-server settings→ PHP → Extended settings. Log in as a user and go to WWW → PHP → Extended settings.

    Note.

    The administrator can define what values will be displayed to users by default. To do so, go to Web server settings → PHP → Extended settings→ select the variable and click on Display.

  2. Select the variable and click on Edit.
  3. Enter a new Value for the variable. 

The global configuration file is kept in:

  • CentOS: /etc/php.ini for the PHP native and in /opt/<PHP version>/etc/php.ini for alternative versions.
  • Debian, Ubuntu: every PHP mode has an individual file. /etc/php5/apache2/php.ini/etc/php5/cgi/php.ini and /etc/php5/fpm/php.ini.

The user configuration files are kept in /var/www/<php-bin directory PHP version>/<WWW-domain owner>/php.ini. The settings that the user has modified are kept in the same directory in the configuration file with the modified parameters of .php.ini.

To modify the user configuration files manually edit the php.ini file and duplicate the changes in the /var/www/<WWW-domain owner>/data/<php-bin directory PHP version>/.php.ini file.

Template for creating configuration files

The /usr/local/mgr5/etc/templates/php.ini file is used as a template for the user configuration files. When creating a new user the PHP settings are modified according to the template. The template contains the following strings per default: 

User configuration file template
session.save_path = "$HOMEDIR/bin-tmp/"
upload_tmp_dir = "$HOMEDIR/bin-tmp/"
sendmail_path = /usr/sbin/sendmail -t -i -f webmaster@example.com

$HOMEDIR is a macro that is changed into a user home directory when a new user is being created.

Settings for the PHP modes "CGI" and "FastCGI (Apache)"

When an ISPmanager user saves the modified PHP settings:

  1. The modified values are specified in the configuration file of modified parameters. 
  2. The content of the user configuration file is fully changed into the content of the global file.
  3. Values from the configuration file of the modified parameters change the corresponding values in the user configuration file. 

When an ISPmanager administrator saves the modified PHP settings:

  1. The values are specified in the global configuration file. 
  2. For every ISPmanager user:
    1. The content of the user configuration file is fully changed into the content of the global file.
    2. Values from the configuration file of the modified parameters change the corresponding values in the user configuration file. 

Settings for the PHP mode "FastCGI (Nginx + PHP-FPM)"

When an ISPmanager user saves the modified PHP settings the modified values are specified into the PHP-FPM configuration file of the user of the corresponding PHP version.

When an ISPmanager administrator saves the modified PHP settings the modified values are specified into the PHP-FPM global configuration file of the corresponding PHP version.

If PHP settings have been changed for a particular website, the changed variable values are saved in the directory:

  • for alternative versions of PHP — /opt/php<version>/etc/php-fpm.d/;

    <version> — the version of PHP. For example, for PHP 5.4, the website configuration files are located in /opt/php54/etc/php-fpm.d/ directory.


  • for the native version of PHP in OS CentOS — /etc/php-fpm.d/;
  • for the native version of PHP in OS Ubuntu, Debian — /etc/php/<version>/fpm/;

    <version> — the version of PHP. For example, for PHP 7.0, the website configuration files are located in /etc/php/7.0/fpm/ directory.

To save PHP settings for a specific site, the control panel creates subdirectories:

  • /user.d — contains PHP configuration files with user settings;
  • /site.d — contains PHP configuration files with settings for the site;
  • /pool.d — contains the PHP-FPM pool configuration files.

To prevent the control panel from creating separate PHP-FPM settings for each site, add the following line to the ISPmanager configuration file:

Option DisableFpmPerSite

Settings for the PHP mode "Apache module"

A user cannot change the PHP settings in this mode. 

When an ISPmanager user saves the changed PHP settings the modified values are specified into the Apache mode configuration file of the user of the corresponding PHP version.

Initial PHP configuration


The main PHP parameters are grouped to facilitate the initial configuration: 

  1. Go to Web-server settings→ PHP → Extended settings → Basic.
  2. Select the Time zone that will be used by default by all the date and time functions. It is specified in the "date.timezone" variable. 
  3. Enter the Execution time of the PHP-script in seconds. The script will not start if it cannot be executed during the specified period. It is specified in the "max_execution_time" variable.
  4. Max. post size - enter the maximum size of post data allowed in MiB. It is specified in the "post_max_size" variable.
  5. Max. files size - provide the maximum size of an uploaded file in MiB. It is specified in the "upload_max_filesize" variable.
  6. Memory limit - provide the maximum amount of memory in bytes that a script is allowed to allocate. It is specified in the "memory_limit" variable.
  7. display_errors - select the checkbox to enable PHP to send information about errors to the browser. For security reasons, we recommend that you disable this option after debugging.
  8. log_errors - select the checkbox to store PHP error messages in the log files. Set the list of errors that will be added into the log. To do so, enable the option Report all errors and in the Ignore errors select the errors that won't be logged. 

The following records are added into the php.ini configuration file:

php.ini configuration file
error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT.

E_ALL — display all errors.

& ~E_DEPRECATED & ~E_STRICT — errors that won't be displayed separated with "& ~".

Disable the option Report all errors and in the  field select the error that will be added into the log. 

The following records are added into the php.ini configuration file:

php.ini configuration file
error_reporting = E_ERROR | E_NOTIC
E_ERROR | E_NOTIC — the errors that are added into the log (separated with " | ".

Restoring the variable value 


To restore a variable value as an administrator, perform the following steps:

  1. Go to Web-server settings → PHP → Extending setiings → Restore.
  2. The modified value is deleted from the PHP global configuration file.
  3. For every ISPmanager user:
    1. The content of the user configuration file is fully changed into the content of the global file.
    2. Values from the configuration file of the modified parameters change the corresponding values in the user configuration file. 

To restore a variable value as a user, perform the following steps:

  1. Go to WWW → PHP → Extending setiings → Restore.
  2. The modified value is deleted from the PHP user configuration file.
Thank you for your feedback!
Was the article useful?
Tell us why not:

it does not match the title

it was hard to understand

I didn't find the answer

recommendations from the article did not help

other

Tell us what you didn't like in the article: