We often need to set custom php.ini values for some domains. We know that we can change that values using PHP selector option in cPanel for Cloudlinux servers. However, certain PHP options are not available in cPanel and we can include the options in cPanel for all PHP versions or for certain PHP versions.

To do so follow the below steps

1) To allow the settings to be modified, it has to be whitelisted in

/etc/cl.selector/php.conf

2) If you wish to add ‘safe_mode’ directive, you can add that directive in the following format in the “/etc/cl.selector/php.conf” file.

Directive = safe_mode { The Directive that you wish to add, for eg: safe_mode, display_errors etc)
Default = Off { default value for that directive, here it is ‘off’, since the type is boolean. If the type is ‘value’, it can be some value say ’30’ for max_execution_time . }
Type = bool { The type can be of (bool, value and list), the list will be in case of upload_max_filesize.)
Remark = <5.4.0 { This specifies that version for which this directive is applicable, <5.4.0 indicates that this directive is only applicable for version less than 5.4 if you wish to enable for all version no need to for this ‘Remark’ field.}

Comment = Enables PHP safe mode puts few restrictions on scripts (say, access to a file system)for security reasons. { This field explains the functionality of the directive}.

Let’s look at one more example of the type ‘list’.

Directive = post_max_size
Default = 8M
Type = list
Range = 2M,4M,8M,16M,32M,64M,128M
Comment = The maximum size in bytes of data that can be posted with the POST method. Typically, should be larger than upload_max_filesize and smaller than memory_limit. Use shortcuts for byte values: K (kilo), M (mega), and G (giga). For example, 16M.

ServerAdminz is a server support company specialized in Outsourced 24/7 Web Hosting Support, Remote Infrastructure Management, NOC, Cloud and Enterprise Security Services. With over 10+ of years of experience in working with major Data Centers and ISPs with 130+ experienced technicians, we continue to manage more than 49,000 servers from 85+ countries and has bagged 5 international awards.

If you have any queries on how to set customPHP values in CloudLinux feel free to leave us a message and our representative will get back to you.[two_third last=”yes” spacing=”yes” center_content=”no” hide_on_mobile=”no” background_color=”” background_image=”” background_repeat=”no-repeat” background_position=”left top” border_position=”all” border_size=”0px” border_color=”” border_style=”” padding=”” margin_top=”” margin_bottom=”” animation_type=”” animation_direction=”” animation_speed=”0.1″ class=”” id=””]

    [/two_third]