PHP Solr extension



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


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 "" >> /home/ubuntu/workspace/php.ini

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

or run this command in terminal

sudo echo "" > /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.


Thanks for that, all good until;

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


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