• Make yourself a nice cup of tea
  • Make sure you have the Windows Java environment installed. It's up to version 6 at the moment.
  • I assume you use XAMPP to run Apache and MySQL and latest version of PHP5 and are running a site off Drupal 6.

Installing Tomcat

  1. If you installed XAMPP with Tomcat, go to your Service Tray, stop XAMPP services and remove the Tomcal directory from within your XAMPP installation. Then restart your XAMPP again. The reason is that you want to be able to configure Tomcat easily from Services Tray in Windows. If Tomcat runs under XAMPP, it does not show up in the Services Tray.
  2. Before you install Tomcat, copy the file c:\windows\\framework\v1.1.4322\msvcr71.dll to c:\windows\system32\msvcr71.dll If you don't do this, Tomcat won't start up.
  3. Now install Tomcat 6.x. Start it running. You should get a page showing at http://localhost:8080 if Tomcat is working.
  4. Have a peek at the file structure of Tomcat. It is very straightforward. Note the directory called webapps.
  5. Now have a nice cup of tea.

Install Apache SOLR

You now need to download Apache Solr.

  1. DO NOT DOWNLOAD the 1.3.0 version that you see in the SOLR download page. It will cause you hours of deep, deep pain because it does not work.
  2. Download the latest nightly file available at Unzip it into somewhere like C:\temp\solr
  3. When you unpack solr you get a shedload of files, and you need to know where to put them to make solr work.
  4. Look into the directory called C:\temp\solr\dist. You will see a file called apache-solr-nightly-war.
  5. Copy this file into wherever your Tomcat webapps directory is.
  6. You will see as if by magic that a directory called 'solr' is created in the webapps directory. This is where the admin pages reside. Don't move this directory or play around with it.
  7. You now need to create a home directory to run solr. SO this is the bit where the Java files reside and you need to tell Tomcat where to find them.
  8. Create a new directory - say C:\solr-home
  9. Go back to the solr files that you downloaded. Have a peek inside the Examples folder. Copy all those files into the C:\solr-home folder.

    The directory structure will look like this

    • C:\solr-home\etc\
    • C:\solr-home\exampleAnalysis
    • C:\solr-home\example-DIH
    • C:\solr-home\exampledocs
    • C:\solr-home\lib\
    • C:\solr-home\logs\
    • C:\solr-home\multicore
    • C:\solr-home\solr\
    • C:\solr-home\webapps\
    • Note there is not conf directory or bin directory.
    • So your solr-home ain't going to work!
  10. Look into the C:\solr-home\solr directory and you will see the conf and bin directories are incredibly inconveniently in there.
  11. Just move them up one level so they are in C:\solr-home directory.

    So now your directory structure will look like

    • C:\solr-home\bin
    • C:\solr-home\conf
    • C:\solr-home\etc\
    • C:\solr-home\exampleAnalysis
    • C:\solr-home\example-DIH
    • C:\solr-home\exampledocs
    • C:\solr-home\lib\
    • C:\solr-home\logs\
    • C:\solr-home\multicore
    • C:\solr-home\solr\
    • C:\solr-home\webapps\
  12. Now we need to tell Tomcat about the directory.
  13. If Tomcat is running, go to the Services Tray, double-click the Tomcat icon and stop the service.
  14. Click on the JAVA tab.
  15. In the Java Options pane type -Dsolr.solrhome=C:\solr-home or whatever directory you made your solr home directory.
  16. Restart Tomcat.
  17. Now go to http://localhost:8080/solr/admin and you should get a page. If you haven't god help you.
  18. Now have another cup of tea.

Install Drupal Apache SOLR module

  1. Now download the latest release version of the Drupal Apache Solr INtegration module at
  2. Install in the normal way. You can try it out but you will get a lot of errors.
  3. You need to install the SOLR PHP client files.
  4. DONT GO HERE These are wrong files and you will immediately go to hell.
  5. Getting the correct files is a pain in the ass as you need to send a fancy Unix command to get them. Run this .. svn checkout -r6 SolrPhpClient
  6. Alternatively, just download the attached version at your own risk
  7. Once you have this file, unzip it. It should be a directory called SolrPhpClient. Put this into your apachesoir drupal module.

Configuring Solr and the Apachesolr module

Now we need to tell solr about the Drupal apachesolr module.

  1. Look into the Drupal apachesolr module.
  2. Copy the file schema.xml and the file solrconfig and put them into C:/solr-home/conf. In other words you overwrite the ones already there. SO you are now connecting your solr installation to the Drupal apachesolr module.

    Or so you thought.

  3. Now check that solr is still running. Go to http://localhost:80880/solr/admin
  4. If it works, slap yourself on the back.
  5. If you get lots or errors then there is a bug that has not been fixed the latest Drupal apachesolr version.
  6. DEBUG Go to the file C:\solr-home\conf\schema.xml

Replace each instance of

<tokenizer class="solr.CharStreamAwareWhitespaceTokenizerFactory"/>


<tokenizer class="solr.WhitespaceTokenizerFactory"/>

Also replace each instance of

<filter class="solr.EnglishPorterFilterFactory" protected="protwords.txt"/>


<filter class="solr.SnowballPorterFilterFactory" language="English" protected="protwords.txt"/>

See for discussion of this.

Now try again. GO to http://localhost:8080/solr/admin

It should work. If it isnt pray very hard and go back over your work.

And finally

Go to your Drupal apachesolr module and edit the file /SolrPhpClient/Apache/Solr/Service.php

There are 2 lines - the first 2 lines of PHP

require_once(dirname(__FILE__) . '/Document.php');
require_once(dirname(__FILE__) . '/Response.php');

These are the absolute filepaths for the document.php and response.php files that are in the Drupal module apachesolr/SolrPhpClient/Apache/Solr directory

Substitute in the paths to both these files

Save the service.php file.


davidseth’s picture

A brilliant write-up. Well done for documenting this and putting it up for all to see.

The latest 6.x-1.0-rc2 includes the schema.xml fixes!



Wimmmmm’s picture

Was struggling with Solr myself for about two weeks now (off & on), and your clear description made me believe it could be done.
And yes, now it works!

Thanks a lot!

ThomasH’s picture

Great tutorial! :D It saved me a lot of time!

For anyone getting the following error:
Can't find resource 'solrconfig.xml' in classpath or 'solr/conf/'

You might want to change startup settings!
-Dsolr.solrhome=C:\solr-home should be -Dsolr.solr.home=D:\solr

marcoka’s picture

thank you a thousand times. that was the solution for me.

artemgy’s picture

thanks for these useful and detailed instructions, they really helped me get my set up sorted.

BTW, I chose to keep using the Xampp Tomcat addon, because I prefer to turn the it on and off using the Xampp control panel instead of the Windows Services Tray

The way I managed to tell Xampp Tomcat where my solr home directory was:

* edit the file c:\xampp\tomcat\bin\setenv.bat
* find the line with JAVA_OPTS
* add the option -Dsolr.solr.home=c:\solr-home
* restart Tomcat

This worked just fine on Vista

artemgy’s picture

Just thought I'd mention that as soon as I tried to integrate Nutch crawlers into Solr, I started having problems.

I couldn't get Nutch 1.0 to run under Xampp Tomcat, however I worked around this by installing a new version of Java (JRE 1.6 rev 16) and I simply set the JRE_HOME variable in the setenv.bat file to the path of my new Java folder.

mariner702’s picture

This is a very good tutorial and it sure saved a lot time from doing it with other methods. I’m sure I did everything correctly but I get the following message when I’m trying to access the Solr settings from site configurations: “Fatal error: require_once() [function.require]: Failed opening required 'C:\xampp\htdocs\mysite\sites\default\modules\apachesolr\SolrPhpClient\Apache\Solrapachesolr/SolrPhpClient/Apache/Solr/Document.php' (include_path='.;C:\xampp\php\pear\') in C:\xampp\htdocs\mysite\sites\default\modules\apachesolr\SolrPhpClient\Apache\Solr\Service.php on line 41.”

Is this because I put the wrong path in the Service.php file? This is what I currently have:
require_once(dirname(__FILE__) . 'apachesolr/SolrPhpClient/Apache/Solr/Document.php');
require_once(dirname(__FILE__) . 'apachesolr/SolrPhpClient/Apache/Solr/Response.php');

If anyone can help, I’d appreciate it.

Mathijs Koenraadt’s picture

Also dont use apache solr 1.5 dev yet - it has errors. Use the latest 1.4!!

2noame’s picture

"Now go to http://localhost:8080/solr/admin and you should get a page. If you haven't god help you."

God help me. My eyes are starting to bleed trying to get this damn thing to work.

2noame’s picture

Finally got it.

Renamed the *solr*.war file to solr.war and renamed the solr-home directory to solr.

Those and following ThomasH's tip from the comment above did it for me. Whew... now on to the next 50 steps...

adaddinsane’s picture

And here's another option if you have the infamous "Can't find resource 'solrconfig.xml' in classpath..." error:

Use the solr.war option and user "solr" as the directory name - but put the 'solr' directory inside the Tomcat directory (just in the top level *not* in the webapps).

Ensure Tomcat is configured for this location and use the solr.solr.home=XXX as suggested above as well.

This works for me. It's possible the name cahnges are not required but I'm not going to fiddle around finding the minimum changes (it may be that the only change needed is moving it into the Tomcat directory).

Hope that helps.

vikozo’s picture

nice description
but what chance do i have - if the Provider where my homepage is don't give all the access?

and the link
Download the latest nightly file available at
is not working

have a nice day

wjaspers’s picture

If you encounter the "Apache Solr service could not be contacted" error, AND you're running Solr AND your Drupal instance on the SAME machine, simply change the server name to the machine's network name -- instead of localhost and it should work just fine.

hmdnawaz’s picture

I want to add some words like test, testing, testpage.
So when I enter a word test in the the search then it should also display results of testing and testpage.
How could i do this?

Ahmad Nawaz
Acquia Certified Developer
Skype: hmdnawaz

hmdnawaz’s picture

but I am using apache solr and tomcat. And I want to enter workds in synonyms.txt file.
I enter the tes, testpage, testing in that file but it did not work.

Ahmad Nawaz
Acquia Certified Developer
Skype: hmdnawaz

mathdz’s picture

In my file already Service.php these two lines:

require_once (dirname (__FILE__). '/ document.php');
require_once (dirname (__FILE__). '/ Response.php');

What do I have to edit this file?