[英]Apache Solr Class 'SolrClient' not found fatal error
我正處於WAMP服務器上的Apache Solr配置階段。 當我在WAMP服務器上運行此代碼時,它顯示PHP致命錯誤,
致命錯誤:第54行的C:\\ wamp \\ www \\ Search Enginge \\ home.php中找不到類'SolrClient'
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/');
?>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.