0

I have following php script which is run perfectly in browser. But when I try to run in terminal, it throwing Fatal Error: Uncausght Error: 'SolrClient' not found for line($fetch_client = new SolrClient($fetch_options);)

$solr_ip = "192.168.0.5";
$solr_path   = '/solr/';
$solr_main_db = 'maindb';

$fetch_options = $insert_options = array (  'hostname' => $solr_ip,
                    'login'    => '',
                    'password' => '',
                    'port'     => '8983',
                    'path'     => $solr_path . $solr_main_db,
            ); 
$fetch_client = new SolrClient($fetch_options);

$query = new SolrQuery();

$query->setQuery('*:*');
$query->setStart(0);

$query->setRows(10);
$query->addSortField('id');    

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

$response = $query_response->getResponse();
echo "<pre>";print_r($response);echo "</pre>";

What's wrong I am doing here? is there anything I am missing?

Note: I was running this script sometime ago with no issue. PHP version 7.0

Solr Version6.3

Ubuntu version 16.04

Your help is greatly appreciated!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.