Skip to Main Content

DevOps, CI/CD and Automation

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Oracle 10g R1 + PHP 5.0.4 + Apache 2.0.54

448701Jul 30 2005 — edited Sep 19 2007
I spent all day trying to get PHP to connect to Oracle on my server and have been unsuccessful. Reading:
http://www.oracle.com/technology/tech/opensource/php/php_troubleshooting_faq.html

It says ORA-12154 (the first error I got) means the tns file could not be found by PHP. So I used the "easy connect" syntax instead which doesn't need the tns set up and the error code changed to 12557. My PHP code is:

<?php
if ($c=oci_connect("username","password", "//server/orcl")) {
echo "Successfully connected to Oracle.\n";
oci_close($c);
} else {
echo "Oracle Connect Error ";
print_r(oci_error());
}
?>

and the output I get is:
Warning: oci_connect() [function.oci-connect]: ociopen_server: Error while trying to retrieve text for error ORA-12557 in C:\...\oracle.php on line 2
Oracle Connect Error Array (
 => 12557 [message] => Error while trying to retrieve text for error ORA-12557 [offset] => 0 [sqltext] => ) 

I've gone through virtually every guide that can be found on the Internet about setting up Oracle on Windows and can't see what I've missed. My server:
Windows Server 2003
Apache 2.0.54
PHP 5.0.4
Oracle Database 10g Release 1
Oracle Instant Client 10.1.04

php_info() does show the oci8 extension loaded:
OCI8 Support  enabled  
Revision  $Revision: 1.257.2.6 $  
Active Persistent Links  0  
Active Links  0  
Temporary Lob support  enabled  
Collections support  enabled  

and I am able to connect via http://server:5560/isqlplus/ with no problems, so i know the oracle services are working. I have already set up the following environment variables:

TNS_ADMIN=C:\Oracle\client
(i have the tns ora file there with the instant client dlls)
ORACLE_HOME=C:\Oracle\product\10.1.0
ORACLE_SID=orcl
Path=C:\oracle\product\10.1.0\Db_1\bin;C:\oracle\product\10.1.0\Db_1\jre\1.4.2\b
in\client;C:\oracle\product\10.1.0\Db_1\jre\1.4.2\bin;...;C:\Oracle\client

The following Oracle services are running:
OracleCSService
OracleDBConsoleorcl
OracleOraDb10g_home1iSQL*Plus
OracleOraDb10g_home1TNSListener
OracleServiceORCL

Anyone know what the problem is?                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 17 2007
Added on Jul 30 2005
11 comments
15,067 views