10 Replies Latest reply: May 7, 2012 6:28 PM by cj RSS

    LDAP and OCI8 doesnot work together

    RENGANATHANMG
      Hi,

      i have installed 11.2 oracle instant client . when i try to compile with oci8 and LDAP together

      this is the configuration for compiling

      ./configure \
      --prefix=/usr/local/apache \
      --with-ldap \
      --with-mysql=/usr/local/mysql \
      --with-pdo-mysql=/usr/local/mysql \
      --with-unixODBC=/usr \
      --enable-sigchild \
      --with-mssql=/usr/local \
      --enable-inline-optimization \
      --with-layout=GNU \
      --enable-bcmath \
      --with-oci8=instantclient,/usr/lib/oracle/11.2/client/lib \
      --with-pdo-oci=/usr/lib/oracle/11.2/client/ \
      --with-openssl \
      --enable-gd-native-ttf \
      --with-freetype-dir=/usr \
      --enable-pcntl \
      --with-zlib \
      --bindir=/local/bin \
      --with-mcrypt=/usr/local/lib \
      --enable-mbstring \
      --enable-ctype \
      --enable-soap \
      --with-jpeg-dir=/usr/lib \
      --with-png-dir=/usr/lib \
      --with-apxs2filter=/usr/local/apache/bin/apxs \
      --with-curl  \
      --with-gd \
      --with-snmp






      it throwing error

      In file included from /root/download/php-5.3.5/ext/ldap/php_ldap.h:30,
      from /root/download/php-5.3.5/ext/ldap/ldap.c:45:
      /usr/include/oracle/11.2/client/ldap.h:68:1: warning: "LBER_CLASS_UNIVERSAL" redefined
      In file included from /root/download/php-5.3.5/ext/ldap/php_ldap.h:27,
      from /root/download/php-5.3.5/ext/ldap/ldap.c:45:
      /usr/include/lber.h:52:1: warning: this is the location of the previous definition
      In file included from /root/download/php-5.3.5/ext/ldap/php_ldap.h:30,
      from /root/download/php-5.3.5/ext/ldap/ldap.c:45:
      /usr/include/oracle/11.2/client/ldap.h:69:1: warning: "LBER_CLASS_APPLICATION" redefined
      In file included from /root/download/php-5.3.5/ext/ldap/php_ldap.h:27,
      from /root/download/php-5.3.5/ext/ldap/ldap.c:45:
      /usr/include/lber.h:53:1: warning: this is the location of the previous definition
      In file included from /root/download/php-5.3.5/ext/ldap/php_ldap.h:30,
      from /root/download/php-5.3.5/ext/ldap/ldap.c:45:
      /usr/include/oracle/11.2/client/ldap.h:70:1: warning: "LBER_CLASS_CONTEXT" redefined
      In file included from /root/download/php-5.3.5/ext/ldap/php_ldap.h:27,
      from /root/download/php-5.3.5/ext/ldap/ldap.c:45:
      /usr/include/lber.h:54:1: warning: this is the location of the previous definition
      In file included from /root/download/php-5.3.5/ext/ldap/php_ldap.h:30,
      from /root/download/php-5.3.5/ext/ldap/ldap.c:45:
      /usr/include/oracle/11.2/client/ldap.h:71:1: warning: "LBER_CLASS_PRIVATE" redefined
      In file included from /root/download/php-5.3.5/ext/ldap/php_ldap.h:27,
      from /root/download/php-5.3.5/ext/ldap/ldap.c:45:
      /usr/include/lber.h:55:1: warning: this is the location of the previous definition
      In file included from /root/download/php-5.3.5/ext/ldap/php_ldap.h:30,
      from /root/download/php-5.3.5/ext/ldap/ldap.c:45:
      /usr/include/oracle/11.2/client/ldap.h:72:1: warning: "LBER_CLASS_MASK" redefined
      In file included from /root/download/php-5.3.5/ext/ldap/php_ldap.h:27,
      from /root/download/php-5.3.5/ext/ldap/ldap.c:45:
      /usr/include/lber.h:56:1: warning: this is the location of the previous definition
      In file included from /root/download/php-5.3.5/ext/ldap/php_ldap.h:30,
      from /root/download/php-5.3.5/ext/ldap/ldap.c:45:
      /usr/include/oracle/11.2/client/ldap.h:75:1: warning: "LBER_PRIMITIVE" redefined
      In file included from /root/download/php-5.3.5/ext/ldap/php_ldap.h:27,
      from /root/download/php-5.3.5/ext/ldap/ldap.c:45:
      /usr/include/lber.h:59:1: warning: this is the location of the previous definition
      In file included from /root/download/php-5.3.5/ext/ldap/php_ldap.h:30,
      from /root/download/php-5.3.5/ext/ldap/ldap.c:45:
      /usr/include/oracle/11.2/client/ldap.h:76:1: warning: "LBER_CONSTRUCTED" redefined
      In file included from /root/download/php-5.3.5/ext/ldap/php_ldap.h:27,
      from /root/download/php-5.3.5/ext/ldap/ldap.c:45:
      /usr/include/lber.h:60:1: warning: this is the location of the previous definition
      In file included from /root/download/php-5.3.5/ext/ldap/php_ldap.h:30,
      from /root/download/php-5.3.5/ext/ldap/ldap.c:45:
      /usr/include/oracle/11.2/client/ldap.h:77:1: warning: "LBER_ENCODING_MASK" redefined
      In file included from /root/download/php-5.3.5/ext/ldap/php_ldap.h:27,
      from /root/download/php-5.3.5/ext/ldap/ldap.c:45:
      /usr/include/lber.h:61:1: warning: this is the location of the previous definition
      In file included from /root/download/php-5.3.5/ext/ldap/php_ldap.h:30,
      from /root/download/php-5.3.5/ext/ldap/ldap.c:45:
      /usr/include/oracle/11.2/client/ldap.h:79:1: warning: "LBER_BIG_TAG_MASK" redefined
      In file included from /root/download/php-5.3.5/ext/ldap/php_ldap.h:27,
      from /root/download/php-5.3.5/ext/ldap/ldap.c:45:
      /usr/include/lber.h:63:1: warning: this is the location of the previous definition
      In file included from /root/download/php-5.3.5/ext/ldap/php_ldap.h:30,
      from /root/download/php-5.3.5/ext/ldap/ldap.c:45:
      /usr/include/oracle/11.2/client/ldap.h:80:1: warning: "LBER_MORE_TAG_MASK" redefined
      In file included from /root/download/php-5.3.5/ext/ldap/php_ldap.h:27,
      from /root/download/php-5.3.5/ext/ldap/ldap.c:45:
      /usr/include/lber.h:64:1: warning: this is the location of the previous definition
      In file included from /root/download/php-5.3.5/ext/ldap/php_ldap.h:30,
      from /root/download/php-5.3.5/ext/ldap/ldap.c:45:
      /usr/include/oracle/11.2/client/ldap.h:88:1: warning: "LBER_ERROR" redefined
      In file included from /root/download/php-5.3.5/ext/ldap/php_ldap.h:27,
      from /root/download/php-5.3.5/ext/ldap/ldap.c:45:
      /usr/include/lber.h:74:1: warning: this is the location of the previous definition
      In file included from /root/download/php-5.3.5/ext/ldap/php_ldap.h:30,
      from /root/download/php-5.3.5/ext/ldap/ldap.c:45:
      /usr/include/oracle/11.2/client/ldap.h:89:1: warning: "LBER_DEFAULT" redefined
      In file included from /root/download/php-5.3.5/ext/ldap/php_ldap.h:27,
      from /root/download/php-5.3.5/ext/ldap/ldap.c:45:
      /usr/include/lber.h:75:1: warning: this is the location of the previous definition
      In file included from /root/download/php-5.3.5/ext/ldap/php_ldap.h:30,
      from /root/download/php-5.3.5/ext/ldap/ldap.c:45:
      /usr/include/oracle/11.2/client/ldap.h:92:1: warning: "LBER_BOOLEAN" redefined
      In file included from /root/download/php-5.3.5/ext/ldap/php_ldap.h:27,
      from /root/download/php-5.3.5/ext/ldap/ldap.c:45:
      /usr/include/lber.h:78:1: warning: this is the location of the previous definition
      In file included from /root/download/php-5.3.5/ext/ldap/php_ldap.h:30,
      from /root/download/php-5.3.5/ext/ldap/ldap.c:45:
      /usr/include/oracle/11.2/client/ldap.h:93:1: warning: "LBER_INTEGER" redefined
      In file included from /root/download/php-5.3.5/ext/ldap/php_ldap.h:27,
      from /root/download/php-5.3.5/ext/ldap/ldap.c:45:
      /usr/include/lber.h:79:1: warning: this is the location of the previous definition
      In file included from /root/download/php-5.3.5/ext/ldap/php_ldap.h:30,
      from /root/download/php-5.3.5/ext/ldap/ldap.c:45:
      /usr/include/oracle/11.2/client/ldap.h:94:1: warning: "LBER_BITSTRING" redefined
      In file included from /root/download/php-5.3.5/ext/ldap/php_ldap.h:27,
      from /root/download/php-5.3.5/ext/ldap/ldap.c:45:
      /usr/include/lber.h:80:1: warning: this is the location of the previous definition
      In file included from /root/download/php-5.3.5/ext/ldap/php_ldap.h:30,
      from /root/download/php-5.3.5/ext/ldap/ldap.c:45:
      /usr/include/oracle/11.2/client/ldap.h:95:1: warning: "LBER_OCTETSTRING" redefined
      In file included from /root/download/php-5.3.5/ext/ldap/php_ldap.h:27,
      from /root/download/php-5.3.5/ext/ldap/ldap.c:45:
      /usr/include/lber.h:81:1: warning: this is the location of the previous definition
      In file included from /root/download/php-5.3.5/ext/ldap/php_ldap.h:30,
      from /root/download/php-5.3.5/ext/ldap/ldap.c:45:
      /usr/include/oracle/11.2/client/ldap.h:96:1: warning: "LBER_NULL" redefined
      In file included from /root/download/php-5.3.5/ext/ldap/php_ldap.h:27,
      from /root/download/php-5.3.5/ext/ldap/ldap.c:45:
      /usr/include/lber.h:82:1: warning: this is the location of the previous definition
      In file included from /root/download/php-5.3.5/ext/ldap/php_ldap.h:30,
      from /root/download/php-5.3.5/ext/ldap/ldap.c:45:
      /usr/include/oracle/11.2/client/ldap.h:97:1: warning: "LBER_ENUMERATED" redefined
      In file included from /root/download/php-5.3.5/ext/ldap/php_ldap.h:27,
      from /root/download/php-5.3.5/ext/ldap/ldap.c:45:
      /usr/include/lber.h:83:1: warning: this is the location of the previous definition
      In file included from /root/download/php-5.3.5/ext/ldap/php_ldap.h:30,
      from /root/download/php-5.3.5/ext/ldap/ldap.c:45:
      /usr/include/oracle/11.2/client/ldap.h:98:1: warning: "LBER_SEQUENCE" redefined
      In file included from /root/download/php-5.3.5/ext/ldap/php_ldap.h:27,
      from /root/download/php-5.3.5/ext/ldap/ldap.c:45:
      /usr/include/lber.h:84:1: warning: this is the location of the previous definition
      In file included from /root/download/php-5.3.5/ext/ldap/php_ldap.h:30,
      from /root/download/php-5.3.5/ext/ldap/ldap.c:45:
      /usr/include/oracle/11.2/client/ldap.h:99:1: warning: "LBER_SET" redefined
      In file included from /root/download/php-5.3.5/ext/ldap/php_ldap.h:27,
      from /root/download/php-5.3.5/ext/ldap/ldap.c:45:
      /usr/include/lber.h:85:1: warning: this is the location of the previous definition
      In file included from /root/download/php-5.3.5/ext/ldap/php_ldap.h:30,
      from /root/download/php-5.3.5/ext/ldap/ldap.c:45:
      /usr/include/oracle/11.2/client/ldap.h:183: error: redefinition of `struct berval'
      make: *** [ext/ldap/ldap.lo] Error 1



      Note:

      its working fine with out LDAP or without OCI 8
        • 1. Re: LDAP and OCI8 doesnot work together
          FlyingGuy
          Are you using PECL to install OCI8 or just how are you trying to accomplish this?

          I have installed OCI on a variety of machines and have never seen this. Using PECL to install OCI8 solves so VERY many issues.
          • 2. Re: LDAP and OCI8 doesnot work together
            cj
            The LDAP extension could do with some love to update it for recent versions of Oracle.
            See https://bugs.php.net/bug.php?id=61450
            See the patch I suggested in https://github.com/php/php-src/pull/19

            The real solution is to initially build PHP without OCI8, and then add OCI8 later as a shared extension.
            This latter step is easiest using PECL: pecl install oci8. You will then need to add 'extension=oci8.so' to your php.ini.

            Other, unrelated, tips are:
            - Use the latest version of PHP 5.3 (or even start looking at PHP 5.4)
            - Don't use --enable-sigchild.  See https://blogs.oracle.com/opal/entry/php_oci8_signal_handling_and_e_1
            - Don't enable PDO_OCI

            Why has the world suddenly had an obsession about LDAP and OCI8 in the last few weeks? Is this for a course?
            • 3. Re: LDAP and OCI8 doesnot work together
              RENGANATHANMG
              Thanks for your solution. Now its working fine
              • 4. Re: LDAP and OCI8 doesnot work together
                933586
                What about if you want pdo_oci8 support? I've been able to fix this issue by removing pdo_oci8 but I need oci8, pdo_oci8 and LDAP working for my PHP app to run. We can still compile fine on Instantclient 11.1.0.6.0, but 11.2.0.3.0 blows up with the same errors in the original post.

                Is this a bug with PHP's LDAP module, the OpenLDAP libraries or Oracle Instantclient? Some can work around this but there is still an underlying issue. I'd like to ensure the right project knows this is an issue still.

                Cheers,

                Tim Vaillancourt

                Edited by: 930583 on 26-Apr-2012 15:14
                • 5. Re: LDAP and OCI8 doesnot work together
                  FlyingGuy
                  Could you please expand on how you are using all these things wrapped together?
                  • 6. Re: LDAP and OCI8 doesnot work together
                    933586
                    My configure line for PHP:

                    ./configure \
                         --host=%{_target} \
                         --prefix=%{prefix}/php-%{version} \
                         --with-apxs2=%{prefix}/apache2/bin/apxs \
                         --with-openssl \
                         --with-sqlite3 \
                         --with-zlib \
                         --with-curl \
                         --enable-mbstring \
                         --with-xsl \
                         --with-pear \
                         --with-zlib-dir \
                         --with-xmlrpc \
                         --with-gd \
                         --enable-gd-native-ttf \
                         --with-pdo-oci=instantclient,%{_builddir}/%{name}/instantclient_11_2 \
                         --with-png-dir \
                         --with-jpeg-dir \
                         --with-pic \
                    --disable-debug \
                         --disable-ipv6 \
                    --with-bz2 \
                    --with-gettext \
                    --with-gmp \
                    --with-iconv \
                         --with-mcrypt \
                         --enable-bcmath \
                         --enable-sockets \
                    --enable-zip \
                         --with-ldap=shared \
                         --with-snmp=shared

                    And then oci8 I install seprately:

                    # oci8 extension
                    cd %{_builddir}/%{name}
                    cd oci8-%{oci8}
                    %{_builddir}/%{name}/phpize
                    ./configure \
                         --host=%{_target} \
                         --prefix=%{prefix}/php-%{version} \
                         --with-php-config=%{_builddir}/%{name}/php-config \
                         --enable-oci8 \
                         --with-oci8=instantclient,%{_builddir}/%{name}/instantclient_11_2 \

                    I also install APC, Suhosin, XDebug, pecl_http, memcache and newrelic extensions separately similar to oci8.

                    Cheers,

                    Tim

                    Edited by: 930583 on 27-Apr-2012 11:23
                    • 7. Re: LDAP and OCI8 doesnot work together
                      FlyingGuy
                      I was talking in more generic terms... Your server side / web app / ??? is using ldap to authenticate??? In what context does all this need to be hopping around at once?

                      Bill
                      • 8. Re: LDAP and OCI8 doesnot work together
                        cj
                        @TVaillancourt did the patch I linked to earlier help? Or can you build pdo_oci shared?

                        The root cause is that PHP needs to distinguish between two implementations of LDAP when you link PHP extensions with Instant Client and Open LDAP at the same time.
                        • 9. Re: LDAP and OCI8 doesnot work together
                          933586
                          FlyingGuy: We run several apps under PHP, some that use both LDAP (for auth) and OCI (for data). Our PHP framework is Symfony 1.x, which by our doing or theirs uses both PDO and non-PDO OCI8. We have considered making 2 PHP binaries and splitting the LDAP portions and OCI portions of our app, but that is a lot of complexity to add to our app for a hacky workaround.

                          cj: I believe I had the same failures when compiling pdo_oci, but I'll try again and provide the errors. I have not tried the patch, but I'll give that a shot! Has the patch been submitted to PHP or Oracle to become mainline?

                          Cheers,

                          Tim
                          • 10. Re: LDAP and OCI8 doesnot work together
                            cj
                            No need to provide the errors: the PDO_OCI issue & solution will be the same.

                            The patch has been submitted to PHP but has not been applied. Note the proviso
                            in the comment that it mixes header & libraries. So, it is still better to compile
                            the extensions as shared.

                            The patch will need to be modified to aid compilation with PDO_OCI.
                            The changed #if in ext/ldap/php_ldap.h would probably need to check for PHP_PDO_OCI_CLIENT_VERSION.
                            Or more cleanly, edit ext/pdo_oci/config.m4 and add
                            AC_DEFINE(HAVE_PDO_OCI,1,[ ])
                            Then ext/ldap/php_ldap.h would test for HAVE_PDO_OCI

                            You can submit "pull" requests in github with any changes.