No announcement yet.

How to Customize PHP Directives

  • Filter
  • Time
  • Show
Clear All
new posts

  • How to Customize PHP Directives

    The PHP .user.ini file allows you to customize PHP directives on a per-directory basis.

    System requirements
    A.You must use PHP version 5.3.0 or higher.
    B.You cannot use the DSO PHP handler.

    Configuration requirements

    We recommend that you review the .user.ini PHP documentation before you implement any configuration changes.
    User.ini file setup

    To set up a user.ini file, perform the following steps:

    1.Log in to your cPanel account.
    2.Navigate to the cPanel's File Manager interface ( Home >> Files >> File Manager ).
    3.Click the Web Root.
    4.Select the Show hidden files checkbox.
    5.Click Go.
    6.Click the target directory.
    7.Click New File.
    8.In the Create a New Field text box, enter .user.ini

    Note: Do not forget to include the period that precedes the file name.

    9.Click Create New File.
    10.Click .user.ini and click Edit.
    11.Enter the PHP directives that you wish to adjust for the directory and click Save.


  • #2
    PHP Selector allows customer to edit php.ini settings. Admin has a full control over which settings can be modified.
    To allow settings to be modifiable, it has to be whitelisted in:

    Here are some of the examples of allowed directives:

    Directive = safe_mode
    Default = Off
    Type = bool
    Remark = <5.4.0
    Comment = Enables PHP safe mode. This mode puts a number of restrictions on scripts (say, access to file system) mainly for security reasons.

    Directive = safe_mode_include_dir
    Type = value
    Remark = <5.4.0
    Comment = If PHP is in the safe mode and a script tries to access some files, files from this directory will bypass security (UID/GID) checks. Th
    e directory must also be in include_path. For example: /dir/inc

    php.ini setting
    Default value
    bool, value (any text), list
    list of values for list Type
    explanation of the setting to display in UI

    Default values, that are shown in PHP-Selector web interface, are taken from '/opt/alt/phpXX/usr/bin/php -i' runtime values, if
    directive is not there, it will use 'default' value that was set in php.conf . So, if you wish to change default value of any option for
    "alternative" php version, please modify /opt/alt/phpXX/etc/php.ini files (where XX = 55, 54, 53, etc according to php version).

    Admin can modify the settings using piniset command.
    Users can use web interface to modify php.ini settings: