PHP Solr PECL Extension installation

若如初见. 提交于 2019-12-10 17:46:30

问题


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.


回答1:


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



回答2:


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



回答3:


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 .




回答4:


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


来源:https://stackoverflow.com/questions/19750343/php-solr-pecl-extension-installation

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!