• Object Storage Service

obs
  1. Help Center
  2. Object Storage Service
  3. Developer Guide (PHP SDK)
  4. Initialization
  5. Configuring an Instance of ObsClient

Configuring an Instance of ObsClient

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://yourdomainname:443.

N/A

ssl_verify

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

  • Path to the server-side root certificate file in .pem format
  • 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

ssl.certificate_authority

This is a deprecated parameter and is used for compatibility with earlier versions. If ssl_verify is set, this parameter is ineffective.

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

  • Path to the server-side root certificate file in .pem format
  • false: The server-side certificates will not be verified.

The default value is false.

N/A

NOTE:
  • 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 connectionTimeout and socketTimeout.
  • The endpoint parameter is the complete address of OBS, containing the protocol type (HTTP or HTTPS), domain name (or IP address), and port number. If the default port number is used (which is 80 for HTTP and 443 for HTTPS), you do not need to specify the port number.
  • 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.