Personal tools
You are here: Home IT Help Center How-tos Install Oracle Client on PHP in IIS 7
Document Actions

Install Oracle Client on PHP in IIS 7

Purpose

Overview of getting the Oracle Database connectivity extensions to load properly under IIS 7.5 in Windows 2008 R2

Prerequisities

IIS 7.5

PHP installation from http://php.iis.net/.  Add oracle extensions.

32-bit Oracle Instant Client 11g: http://www.oracle.com/technetwork/database/features/instant-client/index-100365.html

Step by step

Unzip the Oracle Instant Client and drop the instantclient_11_2 folder into C:\php\ or wherever your PHP installation is.

Set permissions on that folder so the IIS server (IUSR or SYSTEM) has read/write/modify access

In your SYSTEM Environment Variables, add to your path: C:\php\instantclient_11_2  (where the instantclient_11_2 path is its location on your server)

Edit your php.ini and uncomment extension=php_oci8_11g.dll

In IIS Manager, go to your web server home and choose FastCGI Settings.  Highlight the php-cgi.exe entry and choose Edit...

Under Environment Variables, click the box with ... to add another variable.

Add PATH with the Value: %PATH%;C:\php\instantclient_11_2  (where the instantclient_11_2 path is its location on your server)

Restart the IIS server. 


2017: Attaching to PPS

Create the following files:

tnsnames.ora

PPS = 
   (DESCRIPTION =
     (ADDRESS = (PROTOCOL = TCP)(HOST = fis-pps.ucdavis.edu )(PORT = 1860 )
    )
 
   (CONNECT_DATA =
     (SID = ppsprod)
 )
)

ldap.ora

DIRECTORY_SERVERS= (oraldap1.ucdavis.edu:389:636,oraldap2.ucdavis.edu:389:636)
DEFAULT_ADMIN_CONTEXT = "dc=ucdavis,dc=edu"
DIRECTORY_SERVER_TYPE = OID

sqlnet.ora

NAMES.DIRECTORY_PATH = (LDAP, TNSNAMES)
SQLNET.ENCRYPTION_CLIENT = requested
SQLNET.ENCRYPTION_TYPES_CLIENT = (RC4_256,RC4_128,RC4_56,RC4_40,AES256,AES192,AES128)

In IIS, edit the FastCGI Settings Environmental Variable TNS_ADMIN to point to C:\php\instantclient

Restart IIS.

Test Connection:

<?
//PPS taken from C:\php\instantclient_11_2\tnsnames.ora
$ora_db_user = 'username';
$ora_db_pswd = 'password';
$conn = oci_connect("$ora_db_user", "$ora_db_pswd", "//fis-pps.ucdavis.edu:1860/PPS");
if (!$conn) {
   $m = oci_error();
   echo $m['message'], "\n";
   exit;
}
else {
   print "Connected to Oracle!";
}
// Close the Oracle connection
oci_close($conn);
?>

Further information

PHP is 32-bit and therefore you need the 32-bit Oracle Instant Client.

PHP CLI was working fine -- it found the modules appropriately when placed in the SYSTEM Path for the computer (test with php -m or php-cgi -m).  IIS 7 would keep throwing the error: Call to undefined function oci_connect() until I put in the environment variable for FastCGI.

Oracle's Notes on Installation

http://www.oracle.com/technetwork/articles/technote-php-instant-084410.html

« August 2017 »
Su Mo Tu We Th Fr Sa
12345
6789101112
13141516171819
20212223242526
2728293031
 

Powered by Plone CMS, the Open Source Content Management System

This site conforms to the following standards: