XuDing
XuDing

Reputation: 2052

Algolia PHP SDK Hosts unreachable

I am using PHP SDK(v1.8) for Algolia Search.

Having difficulty connecting to Algolia server, when calling

$client = new \AlgoliaSearch\Client("appId", "secret key");
$index = $client->initIndex('demo');        
$index->getSettings();

It throws following exceptions:

> AlgoliaSearch\AlgoliaException: Hosts unreachable: Resolving timed out after 2000 milliseconds,Resolving timed out after 2000 milliseconds,Resolving timed out after 4000 milliseconds,Resolving timed out after 4000 milliseconds,Resolving timed out after 4000 milliseconds

Upvotes: 0

Views: 1027

Answers (1)

XuDing
XuDing

Reputation: 2052

It turns out that my server is having slow connection to Algolia Server.

Solved it by increasing the timeout:


$client->setConnectTimeout(10);

Upvotes: 3

Related Questions