Help Center/ Object Storage Service/ SDK Reference/ PHP/ Initialization/ Configuring an Instance of ObsClient
Updated on 2023-03-16 GMT+08:00

Configuring an Instance of ObsClient

If you have any questions during development, post them on the Issues page of GitHub. For details about parameters and usage of each API, see API Reference.

You can set the following initialization parameters to configure an instance of ObsClient:

Parameter

Description

Recommended Value

key

AK

N/A

secret

SK

N/A

endpoint

Endpoint for accessing OBS, which contains the protocol type, domain name (or IP address), and port name. For example, https://your-endpoint:443. For security purposes, you are advised to use HTTPS.

N/A

ssl_verify

Whether to verify server-side certificates. Possible values are:

  • Path to the server-side root certificate file in .pem format
  • true: The default CAs are used to verify the server-side certificate.
  • false: The server-side certificates will not be verified.

The default value is false.

N/A

max_retry_count

Maximum number of retries when an HTTP/HTTPS connection is abnormal. The default value is 3.

[1, 5]

socket_timeout

Timeout duration for transmitting data at the socket layer, in seconds. The default value is 60.

[10, 60]

connect_timeout

Timeout period for establishing an HTTP/HTTPS connection, in seconds. The default value is 60.

[10, 60]

chunk_size

Block size for reading socket streams, in bytes. The default value is 65536.

Default value

is_cname

Whether to use self-defined domain names to access OBS. The default value is false.

N/A

  • Parameters whose recommended value is N/A need to be set according to the actual conditions.
  • If the network is unstable, you are advised to set larger values for socket_timeout and connect_timeout.
  • If the value of endpoint does not contain any protocol, HTTPS is used by default.
  • After using an instance of ObsClient, you can call ObsClient -> close to close the instance explicitly to reclaim connection resources.
  • If you do not call ObsClient -> close, it will be called by the destructor of ObsClient to reclaim connection resources.
  • For the sake of high DNS resolution performance and OBS reliability, you can set endpoint only to the domain name of OBS, instead of the IP address.