我正在尝试使用日光浴来运行使用solr索引数据的php代码,我已经完成了我的系统,并且工作正常,但是当我在我的同事的系统上运行时,我得到以下错误
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
有人能帮助我吗?
答案 0 :(得分:3)
正如已经提到的,看起来他的系统上没有安装cURL扩展程序,因此install it如果可能,或者只是禁用enable it,或者只是使用一个不同的适配器。
https://github.com/basdenooijer/solarium#requirements
<强>要求强>
日光浴室仅支持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 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);
...