PECL solr not loading due to undefined symbol: cur

2019-03-02 15:00发布

问题:

I'm trying to load the PECL solr extension. I have tried installed it using "pecl install solr" and by downloading and using "phpize/configure/make". In both cases, the extension installs with no errors, but after an apache restart (or when running php on the command line) this error message is always emitted:

PHP Warning: Unable to load dynamic library /usr/lib64/php/modules/solr.so
 - /usr/lib64/php/modules/solr.so: undefined symbol:
 curl_easy_getinfo in Unknown on line 0

I checked and it appears that the created solr.so object does NOT know about /usr/lib64/libcurl.so, even though I specified LDFLAGS -L/usr/lib64 (though I should not need to):

 # ldd modules/solr.so
       linux-vdso.so.1 =>  (0x00007fffd5af8000)
       libc.so.6 => /lib64/libc.so.6 (0x00007fac573c0000)
       /lib64/ld-linux-x86-64.so.2 (0x00000034bc000000)

I am using an out-of-the-box Fedora 15 installation. I have installed many other PECL extensions with no issue. Why is this so hard, and more importantly, how can I fix it?!?

I am using FC15, PHP 5.3.8, curl 7.21.3. Thanks in advance for any help!

回答1:

I couldn't figure out what the problem was either, as I was able to compile via pecl (phpize/configure/make/make install) on Fedora 16 just fine.

First make sure you got libc compat installed:

compat-glibc.i386 : Compatibility C library
compat-glibc.x86_64 : Compatibility C library
compat-glibc-headers.x86_64 : Header files for development using standard C

Once I installed the packages above, I configured/make/make install and it worked fine.



回答2:

My solution was: Edit: /etc/php.d/json.ini and add extension=solr.so this causes loading solr extension after json extension, avoiding json library missing.

Ej json.ini:

; Enable json extension module extension=json.so extension=solr.so



回答3:

That means that it needs curl Install the dependencies like the following:

sudo yum install libxml2-devel curl curl-devel php-curl


回答4:

I faced a similar problem and found a solution to work.

To fix this , just create a file called /etc/php.d/solr.so and add its content as :

;Enable the solr php extension
extension=solr.so

and then just reload your web server. It should work now.



标签: php solr pecl