Reputation: 2168
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 is the 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!
Upvotes: 1
Views: 175
Reputation: 2716
There are several scenarios in which PHP can be called upon, each with their own INI settings. Check that your php-cli INI settings are loading the extension.
Upvotes: 1