Re: [modwsgi] Error ldap.set_option with WSGI

63 views
Skip to first unread message

Graham Dumpleton

unread,
Jun 30, 2012, 3:09:10 AM6/30/12
to mod...@googlegroups.com
Try disabling any LDAP extensions being loaded into mod_php. Likely
the LDAP extension in PHP is linking a different version of some
shared library than whatever Python LDAP client library you are using.

Run 'ldd' on the PHP LDAP extension and Python LDAP client C extension
.so files to see what libraries and versions they are trying to use.

Graham

On 30 June 2012 11:17, Eduardo Gonzalez <ehgonz...@gmail.com> wrote:
> Hi,
>
> When I try to use the ldap.set_option from ldap module is throwing an error.
>
> Here's the traceback:
> [Fri Jun 29 20:18:33 2012] [error] [client 167.134.223.145] mod_wsgi
> (pid=26699): Exception occurred processing WSGI script
> '/var/www/wsgihandler.py'.
> [Fri Jun 29 20:18:33 2012] [error] [client 167.134.223.145] Traceback (most
> recent call last):
> [Fri Jun 29 20:18:33 2012] [error] [client 167.134.223.145]   File
> "/var/www/wsgihandler.py", line 4, in application
> [Fri Jun 29 20:18:33 2012] [error] [client 167.134.223.145]
> ldap.set_option( ldap.OPT_REFERRALS, 0 )
> [Fri Jun 29 20:18:33 2012] [error] [client 167.134.223.145]   File
> "/usr/local/lib/python2.6/dist-packages/python_ldap-2.4.10-py2.6-linux-x86_64.egg/ldap/functions.py",
> line 132, in set_option
> [Fri Jun 29 20:18:33 2012] [error] [client 167.134.223.145]     return
> _ldap_function_call(None,_ldap.set_option,option,invalue)
> [Fri Jun 29 20:18:33 2012] [error] [client 167.134.223.145]   File
> "/usr/local/lib/python2.6/dist-packages/python_ldap-2.4.10-py2.6-linux-x86_64.egg/ldap/functions.py",
> line 63, in _ldap_function_call
> [Fri Jun 29 20:18:33 2012] [error] [client 167.134.223.145]     result =
> func(*args,**kwargs)
> [Fri Jun 29 20:18:33 2012] [error] [client 167.134.223.145] SystemError:
> error 89 from ldap_set_option
>
> Here's wsgi script:
> def application(environ, start_response):
>     import ldap
>     import ldap.filter
>     ldap.set_option( ldap.OPT_REFERRALS, 0 )
>     status = '200 OK'
>     output = 'Hello World!'
>
>     response_headers = [('Content-type', 'text/plain'),
>                         ('Content-Length', str(len(output)))]
>     start_response(status, response_headers)
>
>     return [output]
>
> My system:
> Debian 6.0.5
> Python 2.6.6
> Apache 2.2.16
> WSGI 3.3
> PHP 5.3.3
>
> If mod_php is off the script works OK. I need mod_php and mod_wsgi running
> together.
>
> Any help much aprreciated.
>
> Eduardo Gonzalez.
>
> --
> You received this message because you are subscribed to the Google Groups
> "modwsgi" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/modwsgi/-/UzI3yeVshHYJ.
> To post to this group, send email to mod...@googlegroups.com.
> To unsubscribe from this group, send email to
> modwsgi+u...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/modwsgi?hl=en.

Graham Dumpleton

unread,
Jun 30, 2012, 8:00:57 PM6/30/12
to mod...@googlegroups.com
Don't purge PHP extensions this time, just go into the PHP
configuration file and comment out loading of extensions. Do it in
groups until narrow down which PHP extension is in conflict.

Also do ldd on the main PHP .so itself and see if it is picking up
shared libraries with a different version.

Graham

On 1 July 2012 02:23, Eduardo Gonzalez <ehgonz...@gmail.com> wrote:
> Hi Graham,
>
> Thanks for your quick response.
>
> I disabled LDAP extension into mod_php, but didn't work.
> 1. aptitude purge php5-ldap
> 2. /etc/init.d/apache2 stop && /etc/init.d/apache2 start
> 3. No ldap extension does not show up in phpinfo.
>
> This is the output of ldd:
> # ldd /usr/lib/python2.6/dist-packages/_ldap.so
>     linux-vdso.so.1 =>  (0x00007fffe9dff000)
>     libldap_r-2.4.so.2 => /usr/lib/libldap_r-2.4.so.2 (0x00007fce47438000)
>     liblber-2.4.so.2 => /usr/lib/liblber-2.4.so.2 (0x00007fce4722a000)
>     libsasl2.so.2 => /usr/lib/libsasl2.so.2 (0x00007fce47010000)
>     libpthread.so.0 => /lib/libpthread.so.0 (0x00007fce46df4000)
>     libc.so.6 => /lib/libc.so.6 (0x00007fce46a92000)
>     libresolv.so.2 => /lib/libresolv.so.2 (0x00007fce4687b000)
>     libgnutls.so.26 => /usr/lib/libgnutls.so.26 (0x00007fce465d9000)
>     libdl.so.2 => /lib/libdl.so.2 (0x00007fce463d5000)
>     /lib64/ld-linux-x86-64.so.2 (0x00007fce4789a000)
>     libtasn1.so.3 => /usr/lib/libtasn1.so.3 (0x00007fce461c4000)
>     libz.so.1 => /usr/lib/libz.so.1 (0x00007fce45fad000)
>     libgcrypt.so.11 => /usr/lib/libgcrypt.so.11 (0x00007fce45d35000)
>     libgpg-error.so.0 => /usr/lib/libgpg-error.so.0 (0x00007fce45b31000)
>
> # ldd /usr/lib/php5/20090626/ldap.so
>     linux-vdso.so.1 =>  (0x00007fff155ab000)
>     libsasl2.so.2 => /usr/lib/libsasl2.so.2 (0x00007fc68b46e000)
>     libldap_r-2.4.so.2 => /usr/lib/libldap_r-2.4.so.2 (0x00007fc68b223000)
>     liblber-2.4.so.2 => /usr/lib/liblber-2.4.so.2 (0x00007fc68b014000)
>     libc.so.6 => /lib/libc.so.6 (0x00007fc68acb2000)
>     libdl.so.2 => /lib/libdl.so.2 (0x00007fc68aaae000)
>     libresolv.so.2 => /lib/libresolv.so.2 (0x00007fc68a897000)
>     libgnutls.so.26 => /usr/lib/libgnutls.so.26 (0x00007fc68a5f5000)
>     libpthread.so.0 => /lib/libpthread.so.0 (0x00007fc68a3d9000)
>     /lib64/ld-linux-x86-64.so.2 (0x00007fc68b89c000)
>     libtasn1.so.3 => /usr/lib/libtasn1.so.3 (0x00007fc68a1c8000)
>     libz.so.1 => /usr/lib/libz.so.1 (0x00007fc689fb1000)
>     libgcrypt.so.11 => /usr/lib/libgcrypt.so.11 (0x00007fc689d39000)
>     libgpg-error.so.0 => /usr/lib/libgpg-error.so.0 (0x00007fc689b35000)
>
> What more could i do?
>
> Thanks
> https://groups.google.com/d/msg/modwsgi/-/74RtcujMOu4J.

Eduardo Gonzalez

unread,
Jul 1, 2012, 7:06:26 PM7/1/12
to mod...@googlegroups.com
Hello Graham,

The problem is with oci8 extension. I've installed it as a shared extension. 

This is the output of ldd:
# ldd /usr/lib/php5/20090626/oci8.so
linux-vdso.so.1 =>  (0x00007fff7d24f000)
libclntsh.so.11.1 => /usr/lib/oracle/11.2/client64/lib/libclntsh.so.11.1 (0x00007f7cb5129000)
libc.so.6 => /lib/libc.so.6 (0x00007f7cb4dc2000)
libnnz11.so => /usr/lib/oracle/11.2/client64/lib/libnnz11.so (0x00007f7cb49f5000)
libdl.so.2 => /lib/libdl.so.2 (0x00007f7cb47f1000)
libm.so.6 => /lib/libm.so.6 (0x00007f7cb456f000)
libpthread.so.0 => /lib/libpthread.so.0 (0x00007f7cb4352000)
libnsl.so.1 => /lib/libnsl.so.1 (0x00007f7cb413a000)
libaio.so.1 => /lib/libaio.so.1 (0x00007f7cb3f39000)
/lib64/ld-linux-x86-64.so.2 (0x00007f7cb7bed000)
ldd /usr/lib/php5/20090626/ldap.so 
linux-vdso.so.1 =>  (0x00007fffd3f22000)
libsasl2.so.2 => /usr/lib/libsasl2.so.2 (0x00007f6738bbe000)
libldap_r-2.4.so.2 => /usr/lib/libldap_r-2.4.so.2 (0x00007f6738973000)
liblber-2.4.so.2 => /usr/lib/liblber-2.4.so.2 (0x00007f6738764000)
libc.so.6 => /lib/libc.so.6 (0x00007f6738402000)
libdl.so.2 => /lib/libdl.so.2 (0x00007f67381fe000)
libresolv.so.2 => /lib/libresolv.so.2 (0x00007f6737fe7000)
libgnutls.so.26 => /usr/lib/libgnutls.so.26 (0x00007f6737d45000)
libpthread.so.0 => /lib/libpthread.so.0 (0x00007f6737b29000)
/lib64/ld-linux-x86-64.so.2 (0x00007f6738fec000)
libtasn1.so.3 => /usr/lib/libtasn1.so.3 (0x00007f6737918000)
libz.so.1 => /usr/lib/libz.so.1 (0x00007f6737701000)
libgcrypt.so.11 => /usr/lib/libgcrypt.so.11 (0x00007f6737489000)
libgpg-error.so.0 => /usr/lib/libgpg-error.so.0 (0x00007f6737285000)

I verified shared libraries but I did not find anything wrong.

What can i do to solve this?
Thanks for your help

>> > For more options, visit this group at
>> > http://groups.google.com/group/modwsgi?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups
> "modwsgi" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/modwsgi/-/74RtcujMOu4J.
>
> To post to this group, send email to mod...@googlegroups.com.
> To unsubscribe from this group, send email to

Graham Dumpleton

unread,
Jul 1, 2012, 7:23:21 PM7/1/12
to mod...@googlegroups.com
There are a couple of possibilities here.

A shared version mismatch for additional libraries being linked in by
libclntsh.so. Run 'ldd' on libclntsh.so and see what it wants to use.
Look for not only differences in any ldap shared library, but also
sasl, ssl and crypto libraries.

The oci8 extension, the Oracle library, or something it links, is
declaring some global function/data with a name which isn't prefixed
with a unique Oracle name and it is overriding same name variable in
ldap Python C extension. That gets harder to find and involves having
to run 'nm' on the .so to see what names they export and what clashes.

Do you need to have the Oracle PHP extension enabled?

Graham
>> >> > modwsgi+u...@googlegroups.com.
>> >> > For more options, visit this group at
>> >> > http://groups.google.com/group/modwsgi?hl=en.
>> >
>> > --
>> > You received this message because you are subscribed to the Google
>> > Groups
>> > "modwsgi" group.
>> > To view this discussion on the web visit
>> > https://groups.google.com/d/msg/modwsgi/-/74RtcujMOu4J.
>> >
>> > To post to this group, send email to mod...@googlegroups.com.
>> > To unsubscribe from this group, send email to
>> > modwsgi+u...@googlegroups.com.
>> > For more options, visit this group at
>> > http://groups.google.com/group/modwsgi?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups
> "modwsgi" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/modwsgi/-/yePWcMBNWmIJ.
>
> To post to this group, send email to mod...@googlegroups.com.
> To unsubscribe from this group, send email to
> modwsgi+u...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages