Child pages
  • WHM API 1 Functions - php_set_session_save_path
Skip to end of metadata
Go to start of metadata

Description

This function sets the location of PHP's default session save path.

Important:

In cPanel & WHM version 76 and later, when you disable the WebServer role, the system disables this function. For more information, read our How to Use Server Profiles documentation.

Examples


 JSON API
https://hostname.example.com:2087/cpsess##########/json-api/php_set_session_save_path?api.version=1&path=%2Fvar%2Fcpanel%2Fphp%2Fsessions&overwrite=1
 XML API
https://hostname.example.com:2087/cpsess##########/xml-api/php_set_session_save_path?api.version=1&path=%2Fvar%2Fcpanel%2Fphp%2Fsessions&overwrite=1
 Command Line
whmapi1 php_set_session_save_path path=%2Fvar%2Fcpanel%2Fphp%2Fsessions overwrite=1


Notes:

  • You must URI-encode values.
  • For more information and additional output options, read our Guide to WHM API 1 documentation or run the whmapi1 --help command.
  • If you run CloudLinux™, you must use the full path of the whmapi1 command:

    /usr/local/cpanel/bin/whmapi1

 Output (JSON)
{
   "metadata" : {
      "version" : 1,
      "result" : 1,
      "command" : "php_set_session_save_path",
      "reason" : "OK"
   },
   "data" : {}
}
 Output (XML)
<xml>
  <data></data>
  <metadata>
    <command>php_set_session_save_path</command>
    <reason>OK</reason>
    <result>1</result>
    <version>1</version>
  </metadata>
</xml>


Note:

Use WHM's API Shell interface (WHM >> Home >> Development >> API Shell) to directly test WHM API calls.

Parameters

ParameterTypeDescriptionPossible ValuesExample
pathstring

The directory in which to save session information.

Warning:

For security reasons, do not set this value to /tmp or another insecure location.

This parameter defaults to /var/cpanel/php/sessions.

A valid absolute directory path.

/var/cpanel/php/sessions
overwriteBoolean

Whether to overwrite the existing session save path in the php.ini file.

This parameter defaults to 0.

  • 1 — Overwrite the existing value in the php.ini file.
  • 0 — Do not overwrite the existing value in the php.ini file.
0

Returns

This function returns only metadata.