简体   繁体   中英

PHP Solr PECL Extension installation

I have installed pecl/solr using command,

pecl install solr

and pear using

wget http://pear.php.net/go-pear.phar
php go-pear.phar

After Restart Apache , i am still getting error

Fatal error: Class 'SolrClient' not found

on php code

 $client = new SolrClient($options);

Can any one please describe step by step installation of pecl/solr extension on Centos.

Just to simplify the procedure:

1 Install extension using

pear install pecl/solr 
OR
pecl install -n solr

2 Add this extension to php ini file

echo "extension=solr.so" > /etc/<Your php ini path>/php.ini

3 Restart the server

Service httpd/apache2 restart

You'd wanna check if the Solr extension has been enabled:

php -m | egrep -i solr

If it's not, this should sort it out:

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

The installation methods I found on the web ask to add "extension=solr.so" directly to the php.ini file in use , which seems to throw the error you are getting .

You need to remove "extension=solr.so" from your php.ini file and create a new file called "solr.ini" in your php extensions folder -- most likely /etc/php.d and add "extension=solr.so" to that file .

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 using the below command

sudo etc/init.d/apache2 restart

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