Overview

This document provides advanced PHP configuration file information. Use this document to ensure that you set the appropriate .ini files for your configuration.

The php.ini files

The system searches for and reads php.ini files when PHP starts. When it loads a directive that a php.ini file specifies, it loads the first incident of each directive that it finds.  The system searches for php.ini files in the following order:

  1. A SAPI module specific location, such as the PHPIniDir directive in Apache, the PHP_INI_Path environmental variable, or the php_ini parameter in NSAPI. 
  2. The PHPRC environmental variable. 
  3. The current working directory.
  4. The webserver's SAPI module or PHP directory.
  •  If a php-sapi.ini file exists, where sapi represents the SAPI in use, the system reads that file instead of the php.ini file.
  • The Apache web server changes to the root directory at startup, which causes PHP to read php.ini files that exist in the root user's directories.

In cPanel & WHM, the system also scans the .ini files that exist in the /opt/cpanel/ea-php##/root /etc/php.d/ directory. The system reads these files in alphabetical order. 

To see the files that PHP loaded, you can execute the php_ini_scanned_files() function with your PHP script or run PHP with the --ini option.

PHP handlers and configuration files

CGI

The CGI handler executes PHP applications through the mod_cgi or the mod_cgid Apache modules.

The system only uses the values that the /opt/cpanel/ea-php##/root/etc/php.ini file or the.ini files in the /opt/cpanel/ea-php##/root /etc/php.d/ directory specify. The system reads these files in alphabetical order. 

DSO

The DSO handler embeds the PHP language inside the Apache webserver. DSO allows you to use Apache directives (for example, the php_value and php_admin_value directives).

The system only uses the values that the /opt/cpanel/ea-php##/root/etc/php.ini file or the.ini files in the /opt/cpanel/ea-php##/root /etc/php.d/ directory specify. The system reads these files in alphabetical order. 

FCGI Process Manager (FPM)

FastCGI serves PHP applications through the mod_proxy_fcgi Apache module.

The system loads the PHP INI values in the following order:

  1. The values that the /opt/cpanel/ea-php##/root/etc/php.ini file or the.ini files in the /opt/cpanel/ea-php##/root /etc/php.d/ directory specify. The system reads these files in alphabetical order. 
  2. The /opt/cpanel/ea-php##/root/etc/php-fpm.conf file.

    If a key that starts with php_admin_* exists, it will override the system default value or any previously found value.


  3. The .conf files in the /opt/cpanel/ea-php##/root/etc/php-fpm.d/ directory.

 

Do not edit the /opt/cpanel/ea-php##/root/etc/php-fpm.conf file or the files in the /opt/cpanel/ea-php##/root/etc/php-fpm.d/ directory. If you wish to make changes, you must edit the PHP-FPM .yaml files.

For more information, read our PHP-FPM documentation. 

FCGI daemon (FCGId)

FCGId serves PHP applications through the mod_fcgid Apache module. The mod_fcgid Apache module is an alternative to the mod_cgi Apache module.

The system only uses the values that the /opt/cpanel/ea-php##/root/etc/php.ini file or the.ini files in the /opt/cpanel/ea-php##/root /etc/php.d/ directory specify. The system reads these files in alphabetical order. 

  • You can only use FCGId with MultiPHP on systems that run cPanel & WHM version 74 or later.
  • On systems prior to cPanel & WHM version 78, if your default PHP version uses FCGId, then all PHP versions will use FCGId

For more information, read our Apache Module: FCGId documentation.

LSAPI

LSAPI provides a fast and stable way to serve PHP applications. cPanel & WHM's version of LSAPI differs from the one that CloudLinux provides. This version disables Checkpoint/Restore in Userspace (CRIU), connection pooling, and opcache preservation.

The system only uses the values that the /opt/cpanel/ea-php##/root/etc/php.ini file or the.ini files in the /opt/cpanel/ea-php##/root /etc/php.d/ directory specify. The system reads the files in the /opt/cpanel/ea-php##/root /etc/php.d/ directory in alphabetical order. 

suPHP

This option provides the ability to run PHP scripts as the user with the mod_suphp Apache module.


Additional documentation