90% OFF ALL NEW PLANS + 100-DAY MONEY-BACK GUARANTEE
90% OFF ALL NEW PLANS

PHP configuration files and priority

You can use local .user.ini and php.ini configuration files to change various PHP interpreter settings. These files can be easily created via the Control Panel -> File Manager interface. By default, when a new subdomain is created through the hosting Control Panel -> Subdomains section, a php.ini file will be created automatically in its document root. The php.ini file for your main domain (www subdomain) will be created when your account is activated. For some accounts these default php.ini files may not exist due to legacy settings.

PHP configuration files

Main differences between .user.ini and php.ini files

  • In .user.ini files you can only use directives with the PHP_INI_PERDIR and PHP_INI_USER modes (PHP_INI modes list), while php.ini files can be used for changing all directives supported on our servers.
  • .user.ini files work recursively (for all subfolders). php.ini files do not work recursively (their settings will be valid only for the directory where the php.ini file is located).
  • The values for directives not defined in .user.ini files will be taken from the php.ini file with the highest precedence according to the Priority of PHP configuration files table. This is not so with php.ini files, where the values of all directives that are not defined in the specific php.ini file will be reset to the values of a default PHP installation.
  • For directories using the FPM with OPcache PHP handler, any changes made to .user.ini files will take effect immediately, while you may need to reload the FPM master process for changes to php.ini files to take effect. You can learn more about the FPM master process reloading in our PHP Settings article.

Global php.ini file

The global php.ini file for your account is located in your home directory (/home/USERNAME/php.ini). The settings in this php.ini file are applied globally for all your PHP scripts, unless they are overridden by a local php.ini or .user.ini file.

Default content of php.ini files on our servers

Any automatically generated php.ini files on our servers will have the following content:

post_max_size = 60M
memory_limit = -1
upload_max_filesize = 60M
max_execution_time = 120
expose_php = Off
session.save_path = /tmp
error_reporting = E_ALL & ~E_STRICT & ~E_NOTICE & ~E_DEPRECATED
date.timezone = ${TZ}

Note: If you plan to use local php.ini files, we recommend that you set these directives in them for compatibility reasons. Of course, you can modify the values for these directives to your liking. For example, if you do not want your scripts to use the timezone of the physical location of the server, you can change the default ${TZ} value of the date.timezone directive.

Restore global or main subdomain php.ini file settings to default

You can restore the global php.ini file for your account or the main php.ini files of subdomains to default by using the Restore to default button from the hosting Control Panel -> PHP Settings section.

PHP configuration files priority

PHP interpreter (CGI and FPM handlers)

The precedence order (from highest to lowest) of configuration files of the PHP interpreter is listed below:

PHP configuration file\PHP handler
  CGI handler support
  FPM handler support
.user.ini file in the directory of the executed file  
php.ini file in the directory of the executed file  ×
main php.ini file of the subdomain × 
global php.ini for the account  
server php.ini  
default PHP configuration settings  


Note: The values for directives not defined in .user.ini files will be taken from the php.ini file with the highest precedence from the table listed above. Unlike .user.ini files, the values for directives not defined in a php.ini file will be reset to the values of a default PHP installation.

PHP-CLI

For the command line PHP interpreter (php.cli), the configuration files have the following precedence:

  • php-cli.ini file in the directory of the executed file
  • php.ini file in the directory of the executed file
  • global php.ini for the account
  • server php.ini
  • default PHP configuration settings