Saber Hosney
Saber Hosney

Reputation: 112

Can't connect to Algolia with PHP

I work on a laravel project, and I want to use Algolia search .

I'm using Laravel 5.8 , PHP 7.3.2, MySQL 5.7 , also I tried to use Algolia with plain PHP gave me the same error .

The Scout.php file :

'driver' => env('SCOUT_DRIVER', 'algolia'),
'queue' => env('SCOUT_QUEUE', true),
'algolia' => [
        'id' => env('ALGOLIA_APP_ID', 'MY-APP-ID'),
        'secret' => env('ALGOLIA_SECRET', 'MY-APP-SECRET'),
    ],

.env file :

ALGOLIA_APP_ID=MY-APP-ID
ALGOLIA_SECRET=MY-APP-SECRET
SCOUT_QUEUE = true

I double checked the values I entered as AppID and AdminID, I should be able to connect just fine , but it always says:

Impossible to connect, please check your Algolia Application Id.

I can connect and update data just fine when using Node.JS

Upvotes: 1

Views: 1232

Answers (1)

azeós
azeós

Reputation: 4901

I'm just quoting another answer on SO: How to fix this error “Impossible to connect, please check your Algolia Application Id”?. Full answer there, just quoting the relevant parts:

1) Download the latest cacert.pem from https://curl.haxx.se/ca/cacert.pem

2) Add the following line to php.ini (if this is shared hosting and you don't have access to php.ini then you could add this to .user.ini in public_html)

curl.cainfo="/path/to/downloaded/cacert.pem"

Make sure you enclose the path within double quotation marks!!!

Author: @Anthem.

Upvotes: 4

Related Questions