Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Fatal error: Class 'SolrClient' not found

Tags:

php

solr

I followed this tutorial to run solr using php. However I came across the above error. I looked into the SolrClient Class, but have no idea how to use it.

Is there a step by step guide for this?

like image 379
user2741620 Avatar asked Apr 01 '26 06:04

user2741620


2 Answers

Please run the following commands

sudo apt-get install libcurl4-gnutls-dev libxml2 libxml2-dev
sudo apt-get install libpcre3-dev
sudo pecl install -n solr

Please add extension in php.ini file

sudo echo "extension=solr.so" >> /etc/php5/apache2/php.ini

Please create solr.ini file in /etc/php5/apache2/conf.d/ and add extension=solr.so in that file.

or run this command in terminal

sudo echo "extension=solr.so" > /etc/php5/apache2/conf.d/solr.ini

and restart apache

sudo /etc/init.d/apache2 restart

PHP-SOLR client is installed and ready to use.. :)

like image 107
Lijo Abraham Avatar answered Apr 03 '26 21:04

Lijo Abraham


If you are working in Ubuntu Nginx and php-pfm then try this.

sudo apt-get install libcurl4-gnutls-dev libxml2 libxml2-dev
sudo apt-get install libpcre3-dev
sudo pecl install -n solr

Create solr.ini file

sudo echo "extension=solr.so" >/etc/php5/fpm/conf.d/solr.ini
sudo echo "extension=solr.so" >/etc/php5/cli/conf.d/solr.ini

Restart Nginx and php-fpm

sudo restart php5-fpm
sudo service nginx restart
like image 35
Nanhe Kumar Avatar answered Apr 03 '26 21:04

Nanhe Kumar



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!