Self Help Documentation
tool/setphpini
Description
Sets the php.ini data for an existing domain from a given SPanel user account.
Parameters
Field | Type | Required | Description |
---|---|---|---|
token | string | Yes | Authorizing API token – check API Basics for more information. |
accountuser | string | Yes | The SPanel user account that is being managed or viewed. |
action | string | Yes | The category and function being executed. |
domain | string | Yes | The domain to set the php.ini data for. |
basic | array | No | Array with the basic php.ini data. If left empty (not sent), the function will expect to use the ‘advanced’ parameter. Elements list – everything is required allow_url_fopen Enables the URL-aware fopen wrappers that enable accessing URL object like files. Bool: 1/0 display_errors Determines whether errors should be printed to the screen as part of the output or if they should be hidden from the user. String: ‘STDERR’ or ‘STDOUT’ max_execution_time Sets the maximum time in seconds a script is allowed to run before it is terminated by the parser. This helps prevent poorly written scripts from tying up the server. The default setting is 30. When running PHP from the command line the default setting is 0. int max_input_time This sets the maximum time in seconds a script is allowed to parse input data, like POST and GET. Timing begins at the moment PHP is invoked at the server and ends when execution begins. The default setting is -1, which means that max_execution_time is used instead. Set to 0 to allow unlimited time. int max_input_vars Sets the maximum number of input variables allowed per request and can be used to deter denial of service attacks. int memory_limit Sets the maximum amount of memory in bytes that a script is allowed to allocate. string post_max_size Sets max size of post data allowed. This setting also affects file upload. To upload large files, this value must be larger than upload_max_filesize. string upload_max_filesize The maximum size of an uploaded file. string |
advanced | string | No | String with advanced php.ini data. The raw contents of this string will become the contents of the php.ini file. If this parameter is empty, ‘basic’ should be used. |
Warning
The ‘basic’ parameter will overwrite any custom changes in the php.ini.
Example
$endpointUrl = 'https://123.123.123.123/spanel/api.php';
$postData = [
'token' => 'provided_auth_token',
'accountuser' => 'spanelio',
'action' => 'tool/setphpini',
'domain' => 'spanel.io',
'basic' => [
'allow_url_fopen' => 1,
'display_errors' => 'STDERR',
'max_execution_time' => 0,
'max_input_time' => -1,
'max_input_vars' => 1000,
'memory_limit' => '512M',
'post_max_size' => '20M',
'upload_max_filesize' => '20M'
],
/*'advanced' => 'allow_url_fopen = 1
display_errors = STDERR
max_execution_time = 0
max_input_time = -1
max_input_vars = 1000
memory_limit = 512M
post_max_size = 2000M
upload_max_filesize = 200M'
*/
];
$ch = curl_init();
curl_setopt( $ch, CURLOPT_URL, $endpointUrl);
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt( $ch, CURLOPT_POST, true);
curl_setopt( $ch, CURLOPT_POSTFIELDS, http_build_query($postData));
curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt( $ch, CURLOPT_SSL_VERIFYHOST, false);
$jsonOutput = curl_exec( $ch );
Code language: PHP (php)
You can find more information about the Endpoint URL in our API Basics article.
Output
{
"result": "success",
"data": {
"msg": "Your changes have been saved successfully"
}
}
Code language: JSON / JSON with Comments (json)