Apache Solr Class ‘SolrClient’ не найден фатальная ошибка

Я нахожусь в фазе настройки Apache Solr на сервере WAMP.
Когда я запускаю этот код на сервере WAMP, он показывает PHP фатальную ошибку,

Неустранимая ошибка: класс ‘SolrClient’ не найден в C: \ wamp \ www \ Search Enginge \ home.php в строке 54

home.php

<?php
include "bootstrap.php";

$options = array
(
'hostname' => SOLR_SERVER_HOSTNAME,
'login'    => SOLR_SERVER_USERNAME,
'password' => SOLR_SERVER_PASSWORD,
'port'     => SOLR_SERVER_PORT,
);

$client = new SolrClient($options);

$query = new SolrQuery();

$query->setQuery("*.*");

$query->addField('id')->addField('author')->addField('content_type')->addField('user')->addField('file_type');

$query->setFacet(true);

$query->addFacetField('content_type')->addFacetField('file_type');

$query_response = $client->query($query);

$response = $query_response->getResponse();

$array=(array)$response['facet_counts']['facet_fields']['file_type'];

?>

Bootstrap.php

<?php

/* Domain name of the Solr server */
define('SOLR_SERVER_HOSTNAME', 'localhost');

/* Whether or not to run in secure mode */
define('SOLR_SECURE', true);

/* HTTP Port to connection */
define('SOLR_SERVER_PORT', ((SOLR_SECURE) ? 8990 : 8990));

/* HTTP Basic Authentication Username */
define('SOLR_SERVER_USERNAME', 'admin');

/* HTTP Basic Authentication pasword */
define('SOLR_SERVER_PASSWORD', '');

/* HTTP connection timeout */
/* This is maximum time in seconds allowed for the http data transfer operation. Default value is 30 seconds */
define('SOLR_SERVER_TIMEOUT', 10);

/* File name to a PEM-formatted private key + private certificate (concatenated in that order) */
define('SOLR_SSL_CERT', 'certs/combo.pem');

/* File name to a PEM-formatted private certificate only */
define('SOLR_SSL_CERT_ONLY', 'certs/solr.crt');

/* File name to a PEM-formatted private key */
define('SOLR_SSL_KEY', 'certs/solr.key');

/* Password for PEM-formatted private key file */
define('SOLR_SSL_KEYPASSWORD', 'StrongAndSecurePassword');

/* Name of file holding one or more CA certificates to verify peer with*/
define('SOLR_SSL_CAINFO', 'certs/cacert.crt');

/* Name of directory holding multiple CA certificates to verify peer with */
define('SOLR_SSL_CAPATH', 'certs/');

?>

0

Решение

Просто установите клиент solr-php с помощью pecl;

sudo pecl install solr

Если это приводит к ошибке, возможно, это связано с используемой вами версией php (7. *). Сообщить об этой ошибке Форум.

Затем скомпилируйте и соберите в соответствии с инструкциями в этот GitHub хранилище.

(Если вы используете более новую версию php (7. *), игнорируйте библиотеку «php5-curl»)

Это сработало для меня.

0

Другие решения

Других решений пока нет …

По вопросам рекламы ammmcru@yandex.ru
Adblock
detector