Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm trying to use the Solr PHP extension on the recently-upgraded Debian Wheezy. It installs both from PECL and from sources flawlessly but instead of giving me expected functionality it gives me this on every PHP run:

PHP Warning:  PHP Startup: Unable to load dynamic library 
'/usr/lib/php5/20100525/solr.so' - /usr/lib/php5/20100525/solr.so: 
undefined symbol: curl_easy_getinfo in Unknown on line 0

Also scripts which use the extension throws an error

PHP Error[2]: include(SolrClient.php): failed to open stream: 
No such file or directory in file <...path to my autoloader...>

My main point is that it was set up before and worked like a charm. In the upgrade among the relevant packages only the versions of PHP and libcurl was changed. Instance of Solr itself was left as is.

I have all possible libcurl libraries:

$ locate libcurl
...
/usr/lib/x86_64-linux-gnu/libcurl-gnutls.so.3
/usr/lib/x86_64-linux-gnu/libcurl-gnutls.so.4
/usr/lib/x86_64-linux-gnu/libcurl-gnutls.so.4.2.0
/usr/lib/x86_64-linux-gnu/libcurl.a
/usr/lib/x86_64-linux-gnu/libcurl.la
/usr/lib/x86_64-linux-gnu/libcurl.so
/usr/lib/x86_64-linux-gnu/libcurl.so.3
/usr/lib/x86_64-linux-gnu/libcurl.so.4
/usr/lib/x86_64-linux-gnu/libcurl.so.4.2.0
...
/usr/lib32/libcurl.so.3
/usr/lib32/libcurl.so.4
/usr/lib32/libcurl.so.4.2.0
...

I have instaled the php5-curl package version 5.4.4-2 with aptitude.

I installed the Sorl extensions both with

sudo pecl install solr

(with various combinations of -f and -n flags and tried solr-beta too) and with

wget ...
cd ...
phpize
./configure
make 
make install

I'm installing the 1.0.2 version of extension because it worked before the upgrade from Squeeze to Wheezy. As I said earlier, extension installs without any errors.

I have already added the extension=solr.so incantation to the /etc/php5/mods-available/solr.ini

What magic should I do to make solr extension work? Is this true that the only solution that I have is to downgrade the libcurl version as it was before the upgrade?

share|improve this question
add comment

4 Answers 4

up vote 4 down vote accepted

OK, I found the answer myself. Problem was in the errors in configuration. On newest Wheezy the config tree for PHP is as follows:

/etc/php5/mods-available/*.ini # here's the ini files containing `extension=modulename.so` lines and module-specific config.
         /conf.d/NN-*.ini      # here's the symlinks to real .ini files in mods-available
         /cli/conf.d           # symlink from local CLI conf.d to global conf.d 
         /apache/conf.d        # symlink from local apache conf.d to global conf.d

So I needed to do the following things:

  • Add a file /etc/php5/mods-available/solr.ini with the line "extension=solr.so"
  • Add a symlink /etc/php5/conf.d/30-solr.ini pointing to real solr.ini
  • Do the same thing to curl.so
  • Ensure that the "extension=solr.so" and "extension=curl.so" is not written anywhere else. That was the cause of this strange error message.

I think that the config become messy because of recent upgrade from Squeeze to Wheezy, because all of this configuration set-up should be really done by the package manager.

share|improve this answer
add comment

I was having the same problem with the same error.

FWIW - What worked for me was moving "extension=solr.so" from the top of my php.ini file to the bottom - obviously order is important and the curl extension need to be pulled in first.

Hope it helps someone.

share|improve this answer
    
Yeah, basically, all this work with separating of extension=XXX.so to several distinct files in /etc/php5/conf.d/NN-XXX.ini is about it: to ease the management of loading all this extensions. –  hijarian Jan 11 '13 at 16:30
add comment

For anyone under CentOS 6.4, this did it for me. Thanks to hijarian, this is an adaptation of his answer.

After installing everything and compiling the solr.so extension make a new solr.ini file under /etc/php.d

Using nano, for instance: nano /etc/php.d/solr.ini

Add a line to that file containing extension=solr.so, save and exit.

Open /usr/php.ini file and add extension=solr.so to it also, save and exit.

Restart apache...

/etc/init.d/httpd restart

and you should be all done!

share|improve this answer
add comment

curl module must be loaded BEFORE solr module. So, make shure you have something like this in conf.d : 20-curl.ini 30-solr.ini (and not 10-solr.ini)

Or juste add "extension=solr.so" after your "extension=curl.so"

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.