3 Replies Latest reply: Dec 20, 2012 9:55 PM by cj RSS

    PHP Startup errors - Unable to load dynamic library oci8.so

    user13399186
      I am trying to run the following simple php script:

      <?php
      $db = oci_connect("userId","password","//ipAddress:port/sid");
      if ( !$db ) {
      $e = oci_error();
      trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR);
      }
      $stmt_getPrinter = oci_parse($db, "select distinct printer from persons_printers where Machine_Name = '%PC-JZP%'");
      oci_execute($stmt_getPrinter);

      $status = OCIFetch($stmt_getPrinter);
      if ( $status ) {
      echo htmlentities("successful fetch<br>");
      }
      else{
      echo htmlentities("fetch failed<br>");
      }
      ?>

      When I try to run the script above php -f testConn4.php

      I get the following errors/warnings

      PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php/modules/oci8.so' - /usr/lib/php/modules/oci8.so: undefined symbol: core_globals_id in Unknown on line 0
      *
      *
      *<b>Warning</b>: PHP Startup: Unable to load dynamic library '/usr/lib/php/modules/oci8.so' - /usr/lib/php/modules/oci8.so: undefined symbol: core_globals_id in <b>Unknown</b> on line <b>0</b>
      *
      PHP Fatal error:  Call to undefined function oci_connect() in /share_area/www/docs/testConn4.php on line 2

      Fatal error: Call to undefined function oci_connect() in /share_area/www/docs/testConn4.php on line 2


      Runing Oracle 11g Enterprise Edition Release 11.2.0.1.0
      PHP Version 5.4.9
      PHPInfo() shows the following
      OCI8 Suport: enabled
      Version: 1.4.9

      The OCI8.so file is located in the folder /usr/lib/php/modules with the correct privileges.

      Any Ideas why I am getting these errors/warnings?

      Thanks!!
        • 1. Re: PHP Startup errors - Unable to load dynamic library oci8.so
          cj
          Perhaps a library clash? As shown in the top google hit for core_globals_id) https://bugs.php.net/bug.php?id=56803

          Maybe mismatched compile options used with oci8.so compared with those used to build PHP itself?

          If you downloaded pre-compiled binaries, make sure they all came from the same source and build.
          • 2. Re: PHP Startup errors - Unable to load dynamic library oci8.so
            user13399186
            I was able to resolve part of the problem. It appeared that it was a library clash. I am getting closer.

            I can now run (php -f testConn4.php) the following script from the command line:

            <?php
            $db = oci_connect("userId","password","//host:port/sid");
            if ( !$db ) {
            $e = oci_error();
            trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR);
            }
            $stmt_getPrinter = oci_parse($db, "select distinct printer from persons_printers where Machine_Name like '%PC-JZP%'");
            oci_define_by_name($stmt_getPrinter, 'PRINTER', $printer);
            oci_execute($stmt_getPrinter);
            $status = oci_fetch($stmt_getPrinter);
            if ( $status ) {
            echo htmlentities("successful fetch<br>");
            echo htmlentities("printer is: $printer <br>\n");
            }
            else{
            echo htmlentities("fetch failed<br>");
            }
            ?>

            No errors are produced. It runs successfully.

            However when I run it from my browser I get the following errors on the screen:

            Warning: oci_connect(): ORA-24315: illegal attribute type in /share_area/www/docs/testConn4.php on line 2
            Fatal error: ORA-24315: illegal attribute type in /share_area/www/docs/testConn4.php on line 5

            and the following errors in the log file:

            [20-Dec-2012 15:36:13 America/Boise] PHP Warning: oci_connect(): ORA-24315: illegal attribute type in /share_area/www/docs/testConn4.php on line 2
            [20-Dec-2012 15:36:13 America/Boise] PHP Fatal error: ORA-24315: illegal attribute type in /share_area/www/docs/testConn4.php on line 5

            Any ideas?

            Thanks!!!
            • 3. Re: PHP Startup errors - Unable to load dynamic library oci8.so
              cj
              Looks like the web server environment is resolving an older version of Oracle libraries than oci8.so was compiled with. Make sure the web server environment is the same as you use in command line. On Oracle Linux I set environment variables for Apache in /etc/sysconfig/httpd. For tips and locations in other environments see "Setting the Oracle Environment for PHP on Linux" on page 77 of the updated http://www.oracle.com/technetwork/topics/php/underground-php-oracle-manual-098250.html