Child pages
  • Configuration Values of PHP-FPM
For cPanel & WHM version 76

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »


Overview

This document lists the PHP-FPM system's configuration settings and their default values. This document also explains how to add additional settings to your system's PHP-FPM configuration.


Warning:

We strongly recommend that you only activate Apache PHP-FPM if your server has at least 2 GB of RAM available, or at least 30 MB of RAM per domain. If you enable PHP-FPM on a server with less than the required RAM, your server may experience severe performance issues.

Global directives

cPanel & WHM uses template values for defaults. For example, when the [% ea_php_version %] template value appears in the .yaml file, the system replaces this value with the desired PHP version. The following list outlines the global directives labels:

  • Key — The entry in the .yaml file.
  • Name — The pool name in the /var/cpanel/ApachePHPFPM/system_pool_defaults.yaml configuration file.

    Note:

    For more information about pool names, read our PHP-FPM User Pools documentation.

  • Present if not listed — When you set this value to Yes, the system adds the value to the /var/cpanel/userdata/user/domain.php_fpm.yaml configuration file, where user represents the cPanel user's name and domain represents the domain.
  • Default — The template value that resides in the /var/cpanel/ApachePHPFPM/system.yaml  configuration file.

Warning:

  • You must normalize the period character (.) to an underscore character (_) for all key names when you create or modify the /var/cpanel/ApachePHPFPM/system.yaml file. For example, you would normalize syslog.ident to syslog_ident. Otherwise, the system may not accept the key name.
  • Exercise  extreme  caution when you manually edit  .yaml  files. Incorrect syntax in these files will cause services to fail. We  strongly  suggest that you create a backup of your system before you manually edit  .yaml  files.
KeyNamePresent if not listed

Default

pidpid(tick)/opt/cpanel/[% ea_php_version %]/root/usr/var/run/php-fpm/php-fpm.pid
error_logerror_log(tick)

/opt/cpanel/[% ea_php_version %]/root/usr/var/log/php-fpm/error.log

log_levellog_level(tick)notice
syslog_facilitysyslog.facility(error)daemon
syslog_identsyslog.ident(error)php-fpm
emergency_restart_thresholdemergency_restart_threshold(tick)0
emergency_restart_intervalemergency_restart_interval(tick)0
process_control_timeoutprocess_control_timeout(tick)10
process_maxprocess.max(error)

0

process_priorityprocess.priority(error)N/A
daemonizedaemonize(tick)no
rlimit_filesrlimit_files(error)

N/A

rlimit_corerlimit_core(error)0
events_mechanismevents.mechanism(error)N/A
systemd_intervalsystemd_interval(error)10

Pool name directives

PHP-FPM pools allow you to configure different websites and applications to run under their own user. The following table lists directives that you can configure in the /var/cpanel/ApachePHPFPM/system_pool_defaults.yaml  file:

KeyNamePresent if not listedDefault
useruser(tick)"[% username %]"
groupgroup(tick)nobody
listenlisten(tick)"[% socket_path %]"
listen_ownerlisten.owner(tick)"[% username %]"
listen_grouplisten.group(tick)nobody
listen_modelisten.mode(tick)0660
php_admin_value_disable_functionsphp_admin_value[disable_functions](tick)exec,passthru,shell_exec,system
php_admin_flag_allow_url_fopenphp_admin_flag[allow_url_fopen](tick)on
php_admin_value_short_open_tagphp_admin_value[short_open_tag](tick)on
php_admin_value_doc_rootphp_admin_value[doc_root](tick)

[% documentroot %]

Notes:

  • When you specify a vhost document root for subdomains, the system does not escape the vhost correctly in the subdomain's PHP-FPM configuration file.
  • PHP-FPM does not process certain characters in the document root unless you add double quotes ("") around the document root.
  • You can also add the colon(:), semicolon (;), and parenthesis (()) characters to the document root.
php_admin_value_error_logphp_admin_value[error_log](tick)

[% homedir %]/logs/[% scrubbed_domain %].php.error.log

Note:

The system normalizes the period character (.) to an underscore character (_) for the domain.
For example, the /home/example/logs/example.net.php.error.log file becomes the /home/example/logs/example_net.php.error.log file, where example represents the username and example_net represents the domain name.

php_admin_flag_log_errorsphp_admin_flag[log_errors](tick)on
php_value_error_reportingphp_value[error_reporting](tick)E_ALL & ~E_NOTICE
pmpm(tick)ondemand
pm_max_childrenpm.max_children(tick)5
pm_start_serverspm.start_servers(tick)0
pm_min_spare_serverspm.min_spare_servers(tick)1
pm_max_spare_serverspm.max_spare_servers(tick)5
pm_process_idle_timeoutpm.process_idle_timeout(tick)10
chdirchdir(tick)[% homedir %]
catch_workers_outputcatch_workers_output(tick)yes
listen_backloglisten.backlog(error)-1
listen_allowed_clientslisten.allowed_clients(error)any
listen_acl_userslisten.acl_users(error)N/A
listen_acl_groupslisten.acl_groups(error)N/A
pm_max_requestspm.max_requests(tick)20
pm_status_pathpm.status_path(tick)/status
ping_pathping.path(tick)/ping
request_terminate_timeoutrequest_terminate_timeout(error)

N/A

request_slowlog_timeoutrequest_slowlog_timeout(error)N/A
rlimit_filesrlimit_files(error)N/A
rlimit_corerlimit_core(error)N/A
chrootchroot(error)N/A
clear_envclear_env(error)N/A
security_limit_extensionssecurity.limit_extensions(tick)

The system allows the following options:

  • .phtml
  • .php
  • .php3
  • .php4
  • .php5
  • .php6
  • .php7
slowlogslowlog(error)

N/A

php_value_session_save_handlerphp_value[session.save_handler](error)N/A
php_value_session_save_pathphp_value[session.save_path](error)N/A
php_value_soap_wsdl_cache_dirphp_value[soap.wsdl_cache_dir](error)N/A

For more information about PHP-FPM user pools, read our PHP-FPM User Pools documentation.

Add a value to a configuration

A complete configuration directive line would resemble the following example:

php_value_open_basedir: { name: 'php_value[open_basedir]', value: "[% documentroot %]" }

Note:

This example contains the following values:

  • php_value_open_basedir represents the Key entry.
    • The Key entry must only contain letters, numbers, and underscores.
  • php_value[openbasedir] represents the pool name.
  • documentroot represents the configuration value.

Add an unknown value to a configuration

You can add a value that cPanel & WHM does not currently provide as a default with a YAML map.

To create a YAML map, add a line to the configuration file that resembles the following example: 

php_admin_value_ldap_max_links: { name: 'php_admin_value[ldap.max_links]', value: -1 }

Important:

  • If you prepend any PHP settings with the php_value or php_flag flags, the system will overwrite any previous php.ini values that you set in the user's .htaccess files. To remove these flags, run the following commands:

    find /home -type f -name '.htaccess' -exec grep -Hrn 'php_value' '{}' \;
    find /home -type f -name '.htaccess' -exec grep -Hrn 'php_flag' '{}' \;
  • If you prepend any PHP settings with the with the disable functions or disable_classes flag, the system will append the new php.ini value to the previous one in the user's .htaccess files.
  • For more information, read securephp.net's FastCGI Process Manager (FPM) documentation.

Note:

This example contains the following values:

  • php_admin_value_ldap_max_links represents the Key entry.
    • The Key entry must only contain letters, numbers, and underscores.
  • php_admin_value[ldap.max_links] represents the pool name.
  • -1 represents the configuration value.

Remove default values from a configuration

The system allows you to override default values or remove them from the output.

  • To change a default value, add the following line to your .yaml file.

    php_admin_flag_log_errors: no

    Note:

    This value defaults to Yes.

  • To remove a default value, add the following line to your .yaml file:

    php_admin_flag_log_errors: { present_ifdefault: 0 }

    Note:

    If you set the present_ifdefault value to 0, the system will not display that value in the configuration file and ignores all other values.

Rebuild the PHP-FPM configuration

After you change any of the values in the configuration file, you must rebuild the system's PHP-FPM configuration for the changes to occur. To complete this action, run the following command:

/usr/local/cpanel/scripts/php_fpm_config --rebuild

Additional documentation

  • No labels