Customizing PHP Parameters
In the Plesk interface, you and your customers can fine-tune the PHP settings for individual service plans, add-on plans, subscriptions, websites, and subdomains. One can change the values of some of the most frequently used PHP parameters by selecting the desired value from a list or specifying a custom value. By editing the panel.ini file, you can make the following changes to this scenario:
- Determine what predefined values a PHP parameter can take.
- Change the default value for a PHP parameter.
- Forbid specifying custom values for PHP parameters.
Determining what predefined values a PHP parameter can take
For most PHP parameters, one can select a single value from a list of predefined values. You can create a custom list of predefined values a PHP parameter can take by adding one or more lines following the pattern below to the panel.ini file:
[php]
settings.<parameter_group>.<parameter_name>.values[]=<value>
where
-
<parameter_group>
is the group the chosen PHP parameter belongs to. For more information about the groups of PHP parameters, read “PHP parameters and parameter groups” below. -
<parameter_name>
is the name of the chosen PHP parameter. Use the same syntax as in php.ini. -
<value>
is the predefined value of the parameter you want to add to the list. Use the same syntax as in php.ini.
You need to add one line for every predefined value you want to appear on the list.
For example, by default, the memory_limit
parameter can take one of
the following values: 8M
, 16M
, 32M
, 64M
, and 128M
.
If you want to restrict the choice to 64M
and 128M
only, add the
following lines to the panel.ini
file:
[php]
settings.performance.memory_limit.values[]="64M"
settings.performance.memory_limit.values[]="128M"
Changing the default value for a PHP parameter
For most PHP parameters, a single value from the list of predefined values is marked as the default one. The default value is in effect until a user manually selects a different value. You can change the default value for a PHP parameter by adding a line following the pattern below to the panel.ini file:
[php]
settings.<parameter_group>.<parameter_name>.default=<value>
where
-
<parameter_group>
is the group the chosen PHP parameter belongs to. For more information about the groups of PHP parameters, read “PHP parameters and parameter groups” below. -
<parameter_name>
is the name of the chosen PHP parameter. Use the same syntax as in php.ini. -
<value>
is the chosen parameter’s desired default value. Use the same syntax as in php.ini.
For example, the default value of the open_basedir
parameter is
{WEBSPACEROOT}{/}{:}{TMP}{/}
. To change it to none
, add the
following line to the panel.ini
file:
[php]
settings.general.open_basedir.default="none"
In this example, none
is included in the list of predefined values
for open_basedir
by default. It is possible that the desired default
value for a PHP parameter may not be included in the default list of
predefined values. In this case, you need to create a custom list of
predefined values first.
For example, to change the default value of the execution_time
parameter to 180
, add the following lines to panel.ini
:
[php]
settings.performance.max_execution_time[]=30
settings.performance.max_execution_time[]=60
settings.performance.max_execution_time[]=90
settings.performance.max_execution_time[]=120
settings.performance.max_execution_time[]=180 ; adds 180 to the list of predefined values
settings.performance.max_execution_time.default=180
Forbidding specifying custom values for a PHP parameter
For some PHP parameters, a user can specify a custom value instead of selecting one from the list of predefined values. You can forbid specifying custom values for a PHP parameter by adding a line following the pattern below to the panel.ini file:
[php]
settings.<parameter_group>.<parameter_name>.custom=false
where
-
<parameter_group>
is the group the chosen PHP parameter belongs to. For more information about the groups of PHP parameters, read “PHP parameters and parameter groups” below. -
<parameter_name>
is the name of the chosen PHP parameter. Use the same syntax as in php.ini.
Once you have forbidden specifying a custom value for a PHP parameter, a user can only select values from the list of predefined values.
For example, to forbid specifying a custom value for the
error_reporting
parameter, add the following line to the
panel.ini
file:
[php]
settings.general.error_reporting.custom=false
Customizing PHP-FPM Parameters
To customize PHP parameters that belong to the fpm group, you need to add the following lines to the panel.ini file:
[php]
settings.fpm.pm.start_servers.custom=true
settings.fpm.pm.min_spare_servers.custom=true
settings.fpm.pm.max_spare_servers.custom=true
It is true for any customization of PHP-FPM parameters: determining what predefined values a PHP-FPM parameter can take, changing the default value, or forbidding specifying custom values. You can view the full list of PHP-FPM parameters in the table below, “fpm (Linux only)” parameter group.
For example, to change the default value of the pm.max_children
parameter to 20
, add the following lines to panel.ini
:
[php]
settings.fpm.pm.start_servers.custom=true
settings.fpm.pm.min_spare_servers.custom=true
settings.fpm.pm.max_spare_servers.custom=true
settings.fpm.pm.max_children[]=20
settings.fpm.pm.max_children.default=20
PHP parameters and parameter groups
Here is a list of PHP parameter groups and their corresponding parameters:
PHP parameter group | PHP parameter name |
---|---|
performance | memory_limit |
max_execution_time | |
max_input_time | |
post_max_size | |
upload_max_filesize | |
opcache.enable | |
wincache.ocenabled | |
apc.enabled | |
xcache.cacher | |
disable_functions | |
general | safe_mode |
safe_mode_include_dir | |
safe_mode_exec_dir | |
include_path | |
session.save_path | |
mail.force_extra_parameters | |
register_globals | |
open_basedir | |
error_reporting | |
display_errors | |
log_errors | |
allow_url_fopen | |
file_uploads | |
short_open_tag | |
magic_quotes_gpc | |
fpm (Linux only) | pm.max_children |
pm.max_requests | |
pm | |
pm.start_servers | |
pm.min_spare_servers | |
pm.max_spare_servers | |
fastCgi (Windows only) | maxInstances |
activityTimeout | |
requestTimeout | |
instanceMaxRequests | |
queueLength | |
rapidFailsPerMinute |