Re: Oracle client on web servers

From: Mladen Gogala <gogala.mladen_at_gmail.com>
Date: Thu, 31 Aug 2017 16:23:40 -0400
Message-ID: <6080eec1-170b-9f8f-bd24-e260d16aba41_at_gmail.com>



I usually use instant client, which comes as an RPM or ZIP file. As for the TNS alias lookup, that is what sqlnet.ora and tnsnames.ora are here for. Here is the relevant snippet from the php parameters:

    mgogala_at_umajor:~$ php -i|egrep -i "oci8|oracle|tns_admin"     oci8
    OCI8 Support => enabled
    OCI8 DTrace Support => disabled
    OCI8 Version => 2.1.4
    Oracle Run-time Client Library Version => 12.2.0.1.0     Oracle Compile-time Instant Client Version => 12.2

    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
    ORACLE_HOME => /usr/lib/instantclient_12_2     ORACLE_PATH => /home/mgogala/misc/SQL     TNS_ADMIN => /usr/local/tns
    $_SERVER['ORACLE_HOME'] => /usr/lib/instantclient_12_2
    $_SERVER['ORACLE_PATH'] => /home/mgogala/misc/SQL
    $_SERVER['TNS_ADMIN'] => /usr/local/tns


Instant client is installed in /usr/lib/instantclient_12_2. There is not much to install on either Red Hat or Ubuntu. My tnsnames.ora is on /usr/local/tns. BTW, no matter what kind of a client resolution you want to use, you MUST install some form of an Oracle client. Configuration of the oci8 module is simple, I was just about to upgrade mine when I read your email:

root_at_umajor:~# pecl upgrade -a
downloading oci8-2.1.7.tgz ...
Starting to download oci8-2.1.7.tgz (193,960 bytes) .....done: 193,960 bytes
11 source files, building
running: phpize
Configuring for:

PHP Api Version:         20151012
Zend Module Api No:      20151012

Zend Extension Api No: 320151012
Please provide the path to the ORACLE_HOME directory. Use 'instantclient,/path/to/instant/client/lib' if you're compiling with Oracle Instant Client [autodetect] :
_*instantclient,/usr/lib/instantclient_12_2*__* *_

The text entered in bold, underlined font was entered manually. The oci8.so is then linked and put into the extension_dir directory.

    Build process completed successfully     Installing '/usr/lib/php/20151012/oci8.so'     upgrade ok: channel://pecl.php.net/oci8-2.1.7     configuration option "php_ini" is not set to php.ini location     You should add "extension=oci8.so" to php.ini

The latest version fixes some bugs that I haven't encountered, so I don't really know how painful they were:

http://pecl.php.net/package-changelog.php?package=oci8&release=2.1.7

The product manager for oci8 PHP extension is Chris Jones. His blog can be found here:

https://blogs.oracle.com/opal/

I met Chris personally, he's a very nice and approachable guy just like Jeff Smith, yet another great Oracle product manager who participates in this list. I distinctly remember Chris Jones posting on this list, but I haven't seen any of hist posts since the first season of the Game of Thrones. And that has been a long, long time ago.

On 08/31/2017 03:21 PM, Leroy Kemnitz wrote:
>
> All -
>
>
> We are trying to change our PHP apps to use the OID ldap name
> resolution that is available in OID. We are currently hard-coding the
> connection details in the PHP apps. I am finding very limited docs on
> this topic. We have been able to make this change pretty quickly in
> Java/JDBC thin, but not in PHP. We currently don't have an Oracle
> client installed on our web servers.
>
>
> I am running Oracle 12.1 on Linux 6. PHP version 7.0.22 on Linux 6.
>
>
> How are other people handling the tns alias lookup? Do others hard
> code it?
>
>
> I am debating about installing the Oracle 12 client on the web server,
> but not comfortable with it - Have others installed it on the web
> server? If so, any surprises?
>
>
> Any info would be appreciated.
>
>
> Thanks,
>
>
> LeRoy
>
>
> *LeRoy Kemnitz*
> Oracle Database Administrator
> Office of Information Services
> University of Wisconsin Administration
> (608) 265 -5775
>

-- 
Mladen Gogala
Oracle DBA
Tel: (347) 321-1217


--
http://www.freelists.org/webpage/oracle-l
Received on Thu Aug 31 2017 - 22:23:40 CEST

Original text of this message