Varsha
Varsha

Reputation: 11

curl http handler for solarium solr error

I am trying to use solarium to run php code which uses solr for indexing data , I have done on my system , and its working fine , But when I run on my collegue's system i get the following error

Fatal error: Uncaught exception 'Solarium\Exception\RuntimeException' with message 'cURL is not available, install it to use the CurlHttp adapter' in 
/var/www/app/webroot/kl/vendor/solarium/solarium/library/Solarium/Core/Client/Adapter/Curl.php:67
Stack trace: 
#0 /var/www/app/webroot/kl/vendor/solarium/solarium/library/Solarium/Core/Configurable.php(77): Solarium\Core\Client\Adapter\Curl->init() 
#1 /var/www/app/webroot/kl/vendor/solarium/solarium/library/Solarium/Core/Client/Client.php(484): Solarium\Core\Configurable->__construct() 
#2 /var/www/app/webroot/kl/vendor/solarium/solarium/library/Solarium/Core/Client/Client.php(507): Solarium\Core\Client\Client->createAdapter() 
#3 /var/www/app/webroot/kl/vendor/solarium/solarium/library/Solarium/Core/Client/Client.php(796): Solarium\Core\Client\Client->getAdapter() 
#4 /var/www/app/webroot/kl/vendor/solarium/solarium/library/Solarium/Core/Client/Client.php(766): Solarium\Core\Client\Client->executeRequest(Object(Solarium\Core\Client\Request), NULL) 
#5 /var/www/app/webroot/kl/ve in /var/www/app/webroot/kl/vendor/solarium/solarium/library/Solarium/Core/Client/Adapter/Curl.php on line 67

Can someone help me please ?

Upvotes: 1

Views: 3421

Answers (1)

ndm
ndm

Reputation: 60483

As already mentioned, it looks like the cURL extension is not installed on his system, so either install it if possible, or in case it's just disabled, enable it, or simply use a different adapter.

https://github.com/basdenooijer/solarium#requirements

Requirements

Solarium only supports PHP 5.3 and up. It's highly recommended to have Curl enabled in your PHP environment. However if you don't have Curl available you can switch from using Curl (the default) to another client adapter. The other adapters don't support all the features of the Curl adapter.

HTTP Adapter

https://github.com/basdenooijer/solarium/blob/master/examples/6.1.4-http-adapter.php

...

// create a client instance
$client = new Solarium\Client($config);

// set the adapter to http
$client->setAdapter('Solarium\Core\Client\Adapter\Http');

...

PECL HTTP Adapter

https://github.com/basdenooijer/solarium/blob/master/examples/6.1.2-pecl-http-adapter.php

...

// create a client instance
$client = new Solarium\Client($config);

// set the adapter to peclhttp
$client->setAdapter('Solarium\Core\Client\Adapter\PeclHttp');

...

Zend HTTP Adapter

https://github.com/basdenooijer/solarium/blob/master/examples/6.1.1-zend-http-adapter.php

...

// create a client instance
$client = new Solarium\Client($config);

// set the adapter to zendhttp and get a zendhttp client instance reference
$client->setAdapter('Solarium\Core\Client\Adapter\ZendHttp');
$zendHttp = $client->getAdapter()->getZendHttp();

// you can use any of the zend_http features, like http-authentication
$zendHttp->setAuth('user', 'password!', Zend_Http_Client::AUTH_BASIC);

...

Upvotes: 3

Related Questions