Forum Stats

  • 3,827,682 Users
  • 2,260,803 Discussions
  • 7,897,336 Comments

Discussions

Install instructions for windows81. pc + version for php newbie wishing to use php to access data re

user5716448
user5716448 Member Posts: 1,748 Silver Badge
edited Apr 10, 2017 5:02AM in PHP

Hi All,

Have a windows 8.1 pc. New to php and have enabled IIS on pc and now wish to install php in order to use php to connect and pull data from oracle 11.2.0.4 database

Saw a link on microsoft site but only mentioned sql drivers no mention of oracle.

Anyone know of good link/instructions to install as simply as possible and any steps needed afterwards.

Thanks

Christopher Jones-Oracle

Answers

  • Gaz in Oz
    Gaz in Oz Member Posts: 3,785 Bronze Crown
    edited Apr 7, 2017 3:17AM

    There's a plethora of great articles available from Oracle

    Installing PHP and the Oracle Instant Client for Linux and Windows (11g)

    Installing PHP and the Oracle Instant Client for Linux and Windows - Updated for DB 12c

    If you are installing php on the same server the Oracle database is on, then this may help

    https://docs.oracle.com/cd/E17781_01/appdev.112/e18555/ch_two.htm#TDPPH132

    Here's a great manual, it is free.

    The Underground PHP and Oracle Manual | Homepage

    Cheers,

    Gaz.

    user5716448
  • user5716448
    user5716448 Member Posts: 1,748 Silver Badge
    edited Apr 7, 2017 5:54AM

    Thanks for reply.

    I already have standard oracle client but getting message below when try and include file containing connection string - not sure difference ebtween instant client and standard oracle client - will try isntalling oracle instant client.

    PHP Fatal error: Uncaught Error: Call to undefined function oci_connect()

  • Gaz in Oz
    Gaz in Oz Member Posts: 3,785 Bronze Crown
    edited Apr 7, 2017 7:11AM

    Depending on versions of things, you may not need an instant client. If you do download an instant client, you need to download the one with the same architecture as php you have. Either both 32bit or both 64bit.

    Also, depending on your Oracle client version, php version, you may need to download oci8 from here:

    http://pecl.php.net/package/oci8

    Questions:

    1. Oracle client version and architecture?

    2. php version and architecture?

    3. oci8 version and architecture?

    4. Does you oracle client work as expected?

       c:\> sqlplus user/[email protected]

    5. Using "phpinfo()" is oci8 mentioned in the output?

    6. Have you added a line like this to your php.ini?

    <span class="pln">extension</span><span class="pun">=</span><span class="pln">php_oci8</span><span class="pun">.</span><span class="pln">dll</span>

    Christopher Jones-Oracle
  • user5716448
    user5716448 Member Posts: 1,748 Silver Badge
    edited Apr 7, 2017 9:09AM

    HI,

    1)Have oracle 11.2.0.3 remote database oracle instant client n 12.2.0.1.0  (32-bit) on pc - also have another 11.2.0.3 client on pc added the instant client to PATH in fast-cgi

    2)php

    7.1.3 oracle

    3) don't understand this part have extension=php_oci8_12c.dll  ; but no seaparate oci8 install - is there something diffrent to install for this?

    4) sqlplus gives ORA-12560: TNS protocol adapter error.

    However, can connect with 3rd party tools suhc as pl/sql developer and oracle tools such as warehouse builder to the database concerned.

    Have standard oracle client and also installed oracle instant 12c client as backward-compatible don't understand difference between oracel client and oracle instant client.

    5) using phpinfo oci8 mentioned in configure command but don't see it enabled as separate section in way another colleague does so looks like not enabled for some reason despite

    6) uncommented extnestion line below in php.ini

    extension=php_oci8_12c.dll  ; Use with Oracle Database 12c Instant Client

  • Gaz in Oz
    Gaz in Oz Member Posts: 3,785 Bronze Crown
    edited Apr 7, 2017 12:28PM

    If 5. (running phpinfo()) shows no oci8 section then your configuration is incorrect. If your colleague has a working configuration then just copy theirs. 

  • user5716448
    user5716448 Member Posts: 1,748 Silver Badge
    edited Apr 8, 2017 5:54AM
    1. Thanks - tried that but still no joy

    sqlplus work

    hat is the difference between instant client and oracle client - other applications working with oracle client o.k proving oracle client o.k and php looks to work

    Would have thought would simply be able to use the oracle client libraries by uncommenting the relevant dll in the php.ini file.

  • Gaz in Oz
    Gaz in Oz Member Posts: 3,785 Bronze Crown
    edited Apr 8, 2017 9:22AM

    php 5.6 is supported with Oracle 11.2 client.

    Oracle instant client 12.2 may support php 7... You need to setup oracle 12.2 instant client up properly.

  • Christopher Jones-Oracle
    Christopher Jones-Oracle Member Posts: 1,648 Employee
    edited Apr 9, 2017 10:30PM

    > Would have thought would simply be able to use the oracle client libraries by uncommenting the relevant dll in the php.ini file.

    You can - as long as you have the right Oracle client libraries in your path.  But you have have multiple Oracle client libraries installed. So you either have a clash, or haven't configured IIS so PHP can access the Oracle client libraries, or are not using the correct PHP OCI8 dll for the version of the Oracle client libraries you have.

    The following comments on PHP & IIS are old, but no IIS user has ever given me updates: https://blogs.oracle.com/opal/entry/how_to_use_iis_php_and_oracle

    SQL*Developer commonly connects in a completely different tech stack, so what happens with it isn't relevant to PHP OCI8.

    Anyway, check with your colleague who has it working.

  • user5716448
    user5716448 Member Posts: 1,748 Silver Badge
    edited Apr 10, 2017 5:02AM

    Thanks for reply.

    Have tried setting up TNS_ADMIN environment and checked with colleague.

    Our oracle client directory in the PATH

    He has no ISUR_machine name security privileges explicitly set.

    I have set up security similar to him with full control for uses and administrators on the machine.

    I believe this by default should include the account under which the ISUR is running.

    Have also tried with version php_oci8.dll and php_oci8_11g.dll - still same message

    php error log gives message below - file definitely exists

    [10-Apr-2017 08:57:27 UTC] PHP Warning:  PHP Startup: Unable to load dynamic library 'C:\php\ext\php_oci8_12c.dll' - The specified module could not be found.

    Any idea why it cannot find it?

This discussion has been closed.