1. Install libcurl
yum install curl-devel
2. Install libxml
yum install libxslt-devel
2.1 Make sure both mongo & mongodb php extensions are installed
pecl install mongo
pecl install mongodb
Add the following to php.ini if not already added :
3. Install solr php extension
pecl install -n solr
4. Enable solr extension
Add extension=solr.so in php.ini and restart apache
sudo service httpd restart
php -m | grep solr
Make sure there are no errors, if there are then it can be related to the order in which files are loaded. In which case remove `extension=solr.so` from php.ini and create a new file in /etc/php.d, possible 41-solr.ini such that it’s loaded at the end and add `extension=solr.so` in that.
Confirm if that file is being used by php.ini by the following command
php -i | grep “.ini”
6. Download scripts from https://github.com/5missions/mongoSolrImporter
Change the .ini file according to your mongo & solr connection settings.
Execute the following command to start the import from mongo to solr
php mongoSolrImporter.php -c mongoSolrImporter.ini
NOTE – The sample .ini file lists the field names in capitals, make sure to have the field name appropriate to your mongo collection. I have all the field-names in lower case in both mongo collection & solr document.