简体   繁体   中英

Fatal error: Class 'SolrClient' not found

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?

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.. :)

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

in Debian Linux :

sudo apt-get install libcurl4-gnutls-dev libxml2 libxml2-dev libpcre3-dev php5-dev
sudo pecl install -n solr
sudo echo "extension=solr.so" >/etc/php5/fpm/conf.d/solr.ini
sudo echo "extension=solr.so" >/etc/php5/cli/conf.d/solr.ini
sudo echo "extension=solr.so" >/etc/php5/cgi/conf.d/solr.ini
sudo echo "extension=solr.so" >/etc/php5/apache2/conf.d/solr.ini

sudo /etc/init.d/php5-fpm restart
sudo /etc/init.d/apache2 restart

In CentOS, execute the following commands:

  1. Install the dependencies:

yum install curl-devel libxml2-devel

  1. Install solr module

pecl install solr

  1. Add solr.so extension to php.ini

"extension=solr.so"

  1. Restart Apache:

systemctl restart httpd.service

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM