1

我正在尝试使用日光浴室来运行使用 solr 索引数据的 php 代码,我已经在我的系统上完成了,并且它工作正常,但是当我在我同事的系统上运行时,我收到以下错误

致命错误:未捕获的异常 'Solarium\Exception\RuntimeException' 带有消息 'cURL 不可用,安装它以使用 CurlHttp 适配器'
/var/www/app/webroot/kl/vendor/solarium/solarium/library/Solarium/Core/Client/Adapter/Curl.php:67
堆栈跟踪:
#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 \客户端\请求),空)
#5 /var/www/app/webroot/kl/ve 在 /var/www/app/webroot/kl/vendor/solarium/solarium/library/Solarium/Core/Client/Adapter/Curl.php 第 67 行

有人能帮助我吗 ?

4

1 回答 1

3

如前所述,他的系统上似乎没有安装cURL扩展,所以如果可能的话,要么安装它,要么在它被禁用的情况下,启用它,或者干脆使用不同的适配器。

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

要求

Solarium 仅支持 PHP 5.3 及更高版本。强烈建议在您的 PHP 环境中启用 Curl。但是,如果您没有可用的 Curl,您可以从使用 Curl(默认)切换到另一个客户端适配器。其他适配器不支持 Curl 适配器的所有功能。

HTTP 适配器

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 适配器

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 适配器

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);

...
于 2013-07-10T12:32:50.893 回答