PHP Settings

General Information

The PHP Settings section allows you to adjust certain settings of the PHP interpreter for your account, as well as change the default PHP version.

Generally, the PHP settings for your account are managed through settings/directives in the following configuration files:

  • the global php.ini file for the account,
  • a local php.ini file, or
  • a local .user.ini file.

The PHP Settings section allows easier management of your PHP configuration files.

Adjusting PHP settings through the interface

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.

To edit your PHP configuration files (php.ini or .user.ini), open the PHP Settings section of the Control Panel.

The interface has two modes - Basic and Advanced. You can choose the mode at the left pane.


In Basic mode you can change only a specific set of options. To be able to edit the file in a text mode, you can switch to Advanced Mode.

Using the Refresh the php.ini and .user.ini files list button will provide you with a list of the existing php.ini and .user.ini files for your account. You can then select which one to edit.

Advanced mode

Local php.ini/.user.ini files can be created through the File Manager interface of the Control Panel.

Local .user.ini files

Local .user.ini files are supported in PHP versions after PHP 5.3.0. They work in a similar manner to local php.ini files, with the following differences:
- only INI settings with the modes PHP_INI_PERDIR and PHP_INI_USER will be recognized in .user.ini (http://php.net/manual/en/ini.list.php)
- .user.ini files work recursively - their settings will be valid for all subfolders as well
- when using a .user.ini file, directives that exist in the server php.ini or the global php.ini file for the account but do not exist in the .user.ini file, will be followed as well. This is not so with php.ini files, where all directives that do not exist in the specific php.ini file are reset to the values of a default PHP installation.

NOTE: If both a php.ini and a .user.ini file exist in the same directory, then the PHP interpreter will use the settings from the .user.ini file with precedence over the settings from the php.ini file.

Local php.ini files

Local php.ini files do not work recursively. This means that the settings are active only for the current directory, where the local php.ini file is located, but not for its subdirectories. Also, if a local php.ini files exist in a directory, then all PHP directives that are not present in the php.ini file will be reset to the PHP default values - directives in the server php.ini file and the global php.ini file will be ignored.

A php.ini file should contain the following directives for compatibility reasons:

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

The date.timezone setting should be set according to the timezone you want to set for your PHP scripts. The default value ${TZ} configures PHP to use the timezone of the physical location of the server.

You can then add directives that modify the PHP settings you want. For example, if you want to modify the session.save_path setting, the directives you should include in the php.ini file would be:

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

If you need to restore the global php.ini file back to its original content, click on the Restore to default button.

AttentionIf you wish to apply the same settings to all directories on your account, we recommend deleting all local php.ini and .user.ini files and using only the global php.ini file.


Changing the default PHP version for your account

You can change the default PHP version for your account through the "Default PHP Version" tab. You will see all available versions of PHP listed there

You can choose the desired version of PHP by choosing the proper radio button and pressing "Save changes". You can read the full article on managing PHP versions here.

PHP version for php.cli

The command line PHP interpreter (php.cli) is used when you run PHP scripts through the server command line, or when you run them as cron jobs. Php.cli uses the same PHP version as the one set in the PHP Settings -> "Default PHP Version" section.

NOTE: In some rare cases, due to legacy settings, it is possible the PHP version for php.cli to differ from the one set for the account in the PHP Settings -> "Default PHP Version" section. If you spot such a discrepancy, you can simply set the desired PHP version for your account anew, and this will set the correct version for php.cli as well.