diff --git a/INSTALL.txt b/INSTALL.txt
index ec437cf..0b1320b 100644
--- a/INSTALL.txt
+++ b/INSTALL.txt
@@ -14,10 +14,15 @@ still supported, but this might change in the future.)
 
 [1] http://code.google.com/p/solr-php-client/downloads/list
 
-Afterwards, unpack this archive to drupal's libraries folder, so the directory
-tree looks like this:
+Afterwards, unpack this archive to one of this libraries folder:
 
-/path/to/drupal/sites/all/libraries/
+- sites/all/libraries
+- sites/default/libraries (or sites/example.com/libraries in a multisite setup).
+- profiles/profilename/libraries (if using your own profile).
+
+The directory tree should look like this:
+
+/path/to/drupal/libraries/folder/
   |- SolrPhpClient
      |- Apache/
      |- ChangeLog
diff --git a/search_api_solr.module b/search_api_solr.module
index 02730ea..cd001d6 100644
--- a/search_api_solr.module
+++ b/search_api_solr.module
@@ -12,26 +12,48 @@ function search_api_solr_init() {
 }
 
 /**
+ * Return path to SolrPhpClient library path, or FALSE if not found.
+ */
+function _search_api_solr_solrphpclient_path() {
+  static $path = NULL;
+
+  if (is_null($path)) {
+    $path = FALSE;
+    $searchdir = array();
+    $searchdir[] = 'sites/all/libraries';
+    $searchdir[] = conf_path() . '/libraries';
+    $profile = drupal_get_profile();
+    if (!in_array($profile, array('minimal', 'standard', 'testing'))) {
+      $searchdir[] = 'profiles/' . drupal_get_profile() . '/libraries';
+    }
+    $searchdir[] = drupal_get_path('module', 'search_api_solr');
+    foreach ($searchdir as $dir) {
+      $dir = DRUPAL_ROOT . '/' . $dir . '/SolrPhpClient';
+      if (is_dir($dir)) {
+        $path = $dir;
+        break;
+      }
+    }
+    if ($path == FALSE) {
+      throw new Exception('SolrPhpClient library not found! Please follow the instructions in search_api_solr/INSTALL.txt for installing the Solr search module.');
+    }
+  }
+
+  return $path;
+}
+
+/**
  * Autoloader for the SolrPhpClient classes.
  */
 function _search_api_solr_autoload($name) {
-  static $path, $lookup_cache = array();
+  static $lookup_cache = array();
 
   if (isset($lookup_cache[$name])) {
     return $lookup_cache[$name];
   }
   elseif (substr($name, 0, 11) == 'Apache_Solr') {
-    if (!isset($path)) {
-      foreach (array(dirname(__FILE__), DRUPAL_ROOT . '/sites/all/libraries', NULL) as $path) {
-        if (!$path || is_dir($path .=  '/SolrPhpClient/')) {
-          break;
-        }
-      }
-      if (!$path) {
-        throw new Exception('SolrPhpClient library not found! Please follow the instructions in search_api_solr/INSTALL.txt for installing the Solr search module.');
-      }
-    }
-    if (file_exists($file_path = $path . str_replace('_', '/', $name) . '.php')) {
+    $path = _search_api_solr_solrphpclient_path();
+    if (file_exists($file_path = $path . '/' . str_replace('_', '/', $name) . '.php')) {
       require_once $file_path;
       $lookup_cache[$name] = TRUE;
       return TRUE;
@@ -106,3 +128,4 @@ function search_api_solr_cron() {
     }
   }
 }
+
