I have a simple php script:
<?php $db_user = 'myusername'; $db_pass = 'mypassword'; $db_sid = 'mysid'; $conn = oci_connect( $db_user, $db_pass, $db_sid ); ?>
When I run it (from the browser or from the command line), I get an error message:
Call to undefined function oci_connect
I am using php 5.6.6, which has already appeared with php_oci8_12c.dll.
I have extension=php_oci8_12c.dll in my php.ini
I installed the instant client (12.1) - I tried the 32-bit version and the 64-bit version
I have ORACLE_HOME and TNS_ADMIN environment variables pointing to the client folder (C: \ instantclient_12_1).
I also have C: \ instantclient_12_1 in my path
I have tnsnames.ora in the same folder with this corresponding entry:
MYSID = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = myhost.net)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = MYSERVICE) ) )
I also downloaded SQLDeveloper from http://www.oracle.com/technetwork/developer-tools/sql-developer/downloads/index.html
SQLDeveloper works, recognizes the above tnsnames.ora and connects and successfully runs the query in the same database that my php script is trying to access.
I spent several hours for several days trying to figure it out to no avail.
I use:
php 5.6.6 windows 8.1 IIS (so no answers involving apache please) cmd (run as administrator) Oracle Database 11g Enterprise Edition 11.2.0.3.0
Some information that may be helpful:
Ideally, I would like to use oci 1.4.10 to map to a production server, but have not worried too much about it yet.
pear install oci8-1.4.10.tgz
gives me this error:
The DSP oci8.dsp does not exist
I can not find any explanation for this error, which means something to me.
What am I missing - can someone help me
EDIT:
I have tried various suggestions in other stackoverflow posts, namely:
extension=oci8.so with and without extension=php_oci8_12c.dll
I do not have extension=php_oracle.dll in php.ini file
EDIT:
phpinfo tells me that I am using the correct php.ini file:
Loaded Configuration File => C:\php5.6.6\php.ini
This line from phpinfo may also be useful:
Configure Command => cscript /nologo configure.js "--enable-snapshot-build" "--enable-debug-pack" "--disable-zts" "--disable-isapi" "--disable-nsapi" "--without-mssql" "--without-pdo-mssql" "--without-pi3web" "--with-pdo-oci=c:\php-sdk\oracle\x86\instantclient_12_1\sdk,shared" "--with-oci8-12c=c:\php-sdk\oracle\x86\instantclient_12_1\sdk,shared" "--with-enchant=shared" "--enable-object-out-dir=../obj/" "--enable-com-dotnet=shared" "--with-mcrypt=static" "--without-analyzer" "--with-pgo"
EDIT:
It seems that dsp files are VC ++ project files. Now I decide to learn how to create a php extension, and I hope when I do that I will have enough knowledge to compile the source code of oci8 1.4.10 in a dll that works on Windows 8 - if someone does not save me the answer to this question - it looks like it will take me some time :-)
EDIT:
Adding display_startup_errors = On to php.ini tells me that oci dll is not a valid Win32 application