PHP Solr extension

php

#1

I am having trouble getting the PHP Solr extension recognised. I have installed the extension and added a solr.ini to /etc/php5/mods-available but it is not recognised by my script.

I just get the error “Class ‘SolrClient’ not found”

Many thanks


#2

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 (note php.ini location)

echo "extension=solr.so" >> /home/ubuntu/workspace/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

Note: Thanks to this Stack Overflow for the help.


#3

Thanks for that, all good until;

sudo echo “extension=solr.so” > /etc/php5/apache2/conf.d/solr.ini
bash: /etc/php5/apache2/conf.d/solr.ini: Permission denied


#4

Sorted now! Creating solr.ini manually rather the echo command worked.

Thanks