Forum Stats

  • 3,875,592 Users
  • 2,266,952 Discussions
  • 7,912,265 Comments

Discussions

OCI8 Install fail

pans_soul
pans_soul Member Posts: 9
edited Jun 7, 2017 3:08PM in PHP

Hello,

OS = Solaris 11.3 SRU 19

PHP = 5.6.22 (latest available on repository)

Solaris Studio = 12.4

Apache = 2.2

Attempting to follow instructions at:

http://www.oracle.com/technetwork/database/database-technologies/php/201212-ug-php-oracle-1884760.pdf

I have tried 3 different oracle clients:

ELF 64-bit MSB executable SPARCV9 Version 1, dynamically linked, not stripped

ELF 32-bit MSB executable SPARC32PLUS Version 1, V8+ Required, dynamically linked, not stripped

as well as OIC version that came with Solarisstudio12.4

All with the same end result:

ld: fatal: file /opt/solarisstudio12.4/OIC/libclntsh.so: wrong ELF class: ELFCLASS64

collect2: error: ld returned 1 exit status

*** Error code 1

make: Fatal error: Command failed for target `oci8.la'

ERROR: `make' failed

Any suggestions greatly appreciated.

pans_soul

Best Answer

  • C.Mohrman-Oracle
    C.Mohrman-Oracle Member Posts: 4
    edited May 22, 2017 10:22PM Answer ✓

    Hey there.

    I did not actually test the extension with an actual database but so far things look good.

    So please let us know how it goes for you.  Thanks.

    Here's what I did step by step on a sparc machine running S11.3sru19.

    Note that I couldn't get pecl to do this so we'll have to do it manually.

    Also note that we now have native IPS packages for instantclient.

    ## install Oracle instantclient

    # pkg list | grep instantclient

    consolidation/instantclient/instantclient-incorporation 12.1.0.2.0-3              i--

    database/oracle/instantclient                    12.1.0.2.0-3              i--

    database/oracle/instantclient/jdbc-supplement    12.1.0.2.0-3              i--

    database/oracle/instantclient/odbc-supplement    12.1.0.2.0-3              i--

    developer/oracle/instantclient/sdk                12.1.0.2.0-3              i--

    ## So if instantclient is NOT installed at a minimum

    # pkg install -v database/oracle/instantclient developer/oracle/instantclient/sdk

    ## download oci8

    $ cd /export/home/cmohrman/

    $ wget https://pecl.php.net/get/oci8-2.0.12.tgz

    $ tar -xpzf oci8-2.0.12.tgz

    $ cd oci8-2.0.12

    ## for convenience I've set php 5.6 to be the default php

    $ php -v

    PHP 5.3.29 (cli) (built: Sep 21 2015 08:49:34)

    Copyright (c) 1997-2014 The PHP Group

    Zend Engine v2.3.0, Copyright (c) 1998-2014 Zend Technologies

        with Zend OPcache v7.0.2, Copyright (c) 1999-2013, by Zend Technologies

        with Xdebug v2.2.0, Copyright (c) 2002-2012, by Derick Rethans

        with Suhosin v0.9.33, Copyright (c) 2007-2012, by SektionEins GmbH

    # pkg set-mediator --no-backup-be -v -V 5.6 php

    # php -v

    PHP 5.6.22 (cli) (built: Mar 22 2017 09:59:29)

    Copyright (c) 1997-2016 The PHP Group

    Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies

    $ phpize

    ## edit configure

    ## OCISDKZIPINC=$PHP_OCI8_INSTANT_CLIENT/sdk/include

    ## to

    ## OCISDKZIPINC=/usr/oracle/instantclient/12.1/sdk/include

    $ CC=gcc CFLAGS=-m64 ./configure --with-oci8=instantclient,/usr/oracle/instantclient/12.1/lib/64

    $ gmake

    ## now become root

    # gmake install

    # file /usr/php/5.6/lib/extensions/no-debug-zts-20131226/oci8.so

    /usr/php/5.6/lib/extensions/no-debug-zts-20131226/oci8.so:      ELF 64-bit MSB dynamic lib SPARCV9 Version 1, dynamically linked, not stripped, no debugging information available

    # vi /etc/php/5.6/conf.d/extensions.ini

    add

    extension=oci8.so

    # svcadm restart apache24

    # php -i | grep -i oci

    PHP Warning:  Unknown: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in Unknown on line 0

    oci8

    OCI8 Support => enabled

    OCI8 DTrace Support => disabled

    OCI8 Version => 2.0.12

    oci8.connection_class => no value => no value

    oci8.default_prefetch => 100 => 100

    oci8.events => Off => Off

    oci8.max_persistent => -1 => -1

    oci8.old_oci_close_semantics => Off => Off

    oci8.persistent_timeout => -1 => -1

    oci8.ping_interval => 60 => 60

    oci8.privileged_connect => Off => Off

    oci8.statement_cache_size => 20 => 20

    pans_soulpans_soul

Answers

  • pans_soul
    pans_soul Member Posts: 9
    edited May 18, 2017 10:46AM

    Think I left out the pecl command:

    pecl install oci8-2.0.12

  • C.Mohrman-Oracle
    C.Mohrman-Oracle Member Posts: 4
    edited May 22, 2017 10:22PM Answer ✓

    Hey there.

    I did not actually test the extension with an actual database but so far things look good.

    So please let us know how it goes for you.  Thanks.

    Here's what I did step by step on a sparc machine running S11.3sru19.

    Note that I couldn't get pecl to do this so we'll have to do it manually.

    Also note that we now have native IPS packages for instantclient.

    ## install Oracle instantclient

    # pkg list | grep instantclient

    consolidation/instantclient/instantclient-incorporation 12.1.0.2.0-3              i--

    database/oracle/instantclient                    12.1.0.2.0-3              i--

    database/oracle/instantclient/jdbc-supplement    12.1.0.2.0-3              i--

    database/oracle/instantclient/odbc-supplement    12.1.0.2.0-3              i--

    developer/oracle/instantclient/sdk                12.1.0.2.0-3              i--

    ## So if instantclient is NOT installed at a minimum

    # pkg install -v database/oracle/instantclient developer/oracle/instantclient/sdk

    ## download oci8

    $ cd /export/home/cmohrman/

    $ wget https://pecl.php.net/get/oci8-2.0.12.tgz

    $ tar -xpzf oci8-2.0.12.tgz

    $ cd oci8-2.0.12

    ## for convenience I've set php 5.6 to be the default php

    $ php -v

    PHP 5.3.29 (cli) (built: Sep 21 2015 08:49:34)

    Copyright (c) 1997-2014 The PHP Group

    Zend Engine v2.3.0, Copyright (c) 1998-2014 Zend Technologies

        with Zend OPcache v7.0.2, Copyright (c) 1999-2013, by Zend Technologies

        with Xdebug v2.2.0, Copyright (c) 2002-2012, by Derick Rethans

        with Suhosin v0.9.33, Copyright (c) 2007-2012, by SektionEins GmbH

    # pkg set-mediator --no-backup-be -v -V 5.6 php

    # php -v

    PHP 5.6.22 (cli) (built: Mar 22 2017 09:59:29)

    Copyright (c) 1997-2016 The PHP Group

    Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies

    $ phpize

    ## edit configure

    ## OCISDKZIPINC=$PHP_OCI8_INSTANT_CLIENT/sdk/include

    ## to

    ## OCISDKZIPINC=/usr/oracle/instantclient/12.1/sdk/include

    $ CC=gcc CFLAGS=-m64 ./configure --with-oci8=instantclient,/usr/oracle/instantclient/12.1/lib/64

    $ gmake

    ## now become root

    # gmake install

    # file /usr/php/5.6/lib/extensions/no-debug-zts-20131226/oci8.so

    /usr/php/5.6/lib/extensions/no-debug-zts-20131226/oci8.so:      ELF 64-bit MSB dynamic lib SPARCV9 Version 1, dynamically linked, not stripped, no debugging information available

    # vi /etc/php/5.6/conf.d/extensions.ini

    add

    extension=oci8.so

    # svcadm restart apache24

    # php -i | grep -i oci

    PHP Warning:  Unknown: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in Unknown on line 0

    oci8

    OCI8 Support => enabled

    OCI8 DTrace Support => disabled

    OCI8 Version => 2.0.12

    oci8.connection_class => no value => no value

    oci8.default_prefetch => 100 => 100

    oci8.events => Off => Off

    oci8.max_persistent => -1 => -1

    oci8.old_oci_close_semantics => Off => Off

    oci8.persistent_timeout => -1 => -1

    oci8.ping_interval => 60 => 60

    oci8.privileged_connect => Off => Off

    oci8.statement_cache_size => 20 => 20

    pans_soulpans_soul
  • pans_soul
    pans_soul Member Posts: 9
    edited May 24, 2017 10:52AM

    Worked like a charm. The only additional steps I had to take follow:

    # php -i | grep -i oci

    PHP Warning:  PHP Startup: Unable to load dynamic library '/etc/php/5.6/modules/oci8.so' - ld.so.1: php: fatal: /etc/php/5.6/modules/oci8.so: open failed: No such file or directory in Unknown on line 0

    # mkdir /etc/php/5.6/modules/

    # cd /etc/php/5.6/modules/

    # ln -s /usr/php/5.6/lib/extensions/no-debug-zts-20131226/oci8.so

    # php -i | grep -i oci

    oci8

    OCI8 Support => enabled

    OCI8 DTrace Support => disabled

    OCI8 Version => 2.0.12

    oci8.connection_class => no value => no value

    oci8.default_prefetch => 100 => 100

    oci8.events => Off => Off

    oci8.max_persistent => -1 => -1

    oci8.old_oci_close_semantics => Off => Off

    oci8.persistent_timeout => -1 => -1

    oci8.ping_interval => 60 => 60

    oci8.privileged_connect => Off => Off

    oci8.statement_cache_size => 20 => 20

  • pans_soul
    pans_soul Member Posts: 9
    edited Jun 7, 2017 3:08PM

    Hi,

    I'm having trouble getting this process to work with php 5.3. Was there a reason to switch to php5.6? The reason is, even though php 5.6 works fine from CLI it fails from apache. I think I narrowed the problem down to there not being an apache module available for php 5.6. At least not one on oracles package repository. So I was trying to build the oci8 module using php 53 but following the above still results in a

    PHP Warning:  PHP Startup: Unable to load dynamic library '/var/php/5.3/modules/oci8.so' - ld.so.1: php: fatal: /app/oracle/product/11.2.0/client_1/lib/libclntsh.so.11.1: wrong ELF class: ELFCLASS64 in Unknown on line 0

    Thanks

This discussion has been closed.