note 109871 deleted from oci8.installation by cmb
| From: | cmb@php.net | Date: | Sun, 20 Oct 2019 08:52:05 +0000 |
| Subject: | note 109871 deleted from oci8.installation by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-212700@lists.php.net to get a copy of this message | ||
Note Submitter: samantha dot vincent at gmail dot com
----
Windows Server 2008 Standard Edition Service Pack 2 i586
PHP Version 5.4.4
XAMPP 1.8.0
This is what finally got it working for me:
Downloading win32_11gR2_client.zip from the Oracle website.
It was really hard to find, but I got there by choosing Downloads > Oracle Database 11g Release 2
then clicked the "See All" link on the far right of the Microsoft Windows (32-bit)
download links under (11.2.0.1.0)
On this page the second option down is a link to download just the client libraries.
I unzipped it, and ran setup.exe
I chose Runtime, I couldn't get InstantClient to work.
I used the defaults for Oracle Base and Oracle Home, make sure to write these down you need them.
Oracle Base: "D:/app/Administrator"
Oracle Home: "D:/app/Administrator/product/11.2.0/client_1"
I chose just English as the language.
Next'd through the rest of the installer... The nice thing about this full install is that it
sets the Windows Path variable for you, and it has the required library files.
In my php.ini file located in /xampp/php/php.ini
Remove the semicolon from the front of the line: extension=php_oci8_11g.dll
In my apache httpd.conf file in /xampp/apache/conf/httpd.conf
Add the following SetEnv lines to the end of the <Directory "C:/xampp/htdocs"> This
is where you use the oracle base and home paths you wrote down earlier while installing the oracle
client ;) This is what mine looks like without all the comments.
<Directory "C:/xampp/htdocs">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Order allow,deny
Allow from all
SetEnv ORACLE_BASE "D:/app/Administrator"
SetEnv ORACLE_HOME "D:/app/Administrator/product/11.2.0/client_1"
SetEnv ORACLE_SID ""
SetEnv NLS_LANG "AMERICAN_AMERICA.WE8MSWIN1252"
</Directory>
I then created a php file and attempted a connection like this:
<?php
$db = "(DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = TCSDB07)(PORT =
1521))) (CONNECT_DATA = (SERVER = DEDICATED)(SERVICE_NAME = IPROD)))";
$conn = oci_connect('username', 'password', $db);
if(!$conn){
$e = oci_error();
trigger_error(htmlentities($e['message'], ENT_QUTOES), E_USER_ERROR);
}
?>