php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #46295 Could not connect to oralce DB
Submitted: 2008-10-14 22:33 UTC Modified: 2008-10-15 00:07 UTC
From: krish dot v at gmail dot com Assigned: sixd (profile)
Status: Not a bug Package: OCI8 related
PHP Version: 5.2CVS-2008-10-14 (CVS) OS: Sun Solaris 8
Private report: No CVE-ID: None
 [2008-10-14 22:33 UTC] krish dot v at gmail dot com
Description:
------------
Hi,

When connecting to oracle DB. I am getting the below error message.

Warning: ocilogon() [function.ocilogon]: ORA-01034: ORACLE not available ORA-27101: shared memory realm does not exist SVR4 Error: 2: No such file or directory in /Application/s1wbsvr61/docs/TestDB.php on line 10
Couldn't make a connection!

Db is up and running. Also i can able to connect through sqlplus.

And also ORACLE_SID and ORACLE_HOME set.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-10-14 23:11 UTC] johannes@php.net
Did you make sure to set the Oracle environment (ORACLE_HOME, ORACLE_SID, ...) BEFORE starting the server and have set proper group memberships to the web-server user?
 [2008-10-14 23:46 UTC] krish dot v at gmail dot com
Yes i did. Also i set the env inside the script also..here is my 
script.

<?php^M

putenv("ORACLE_HOME=/oracle/product/9.2.0");
putenv("ORACLE_SID=TESTPRD");
putenv("PATH=$ORACLE_HOME/bin:$PATH");
putenv("LD_LIBRARY_PATH=$ORACLE_HOME/lib:$LD_LIBRARY_PATH");
putenv("TNS_ADMIN=/oracle/admin/network/admin");

// create connection^M
$connection = OCILogon("test","test123");^M
^M
// test connection^M
if (!$connection) {^M
echo "Couldn't make a connection!";^M
exit;^M
}^M
^M
// create SQL statement^M
$sql = "SELECT TNAME, TABTYPE, CLUSTERID FROM TAB";^M
^M
// parse SQL statement^M
$sql_statement = OCIParse($connection,$sql);^M
^M
// execute SQL query^M
OCIExecute($sql_statement);^M
^M
// get number of columns for use later^M
$num_columns = OCINumCols($sql_statement);^M
^M
// start results formatting^M
echo "<TABLE BORDER=1>";^M
echo "<TR><TH>Coffee Name</TH><TH>Roast 
Type</TH><TH>Quantity</TH>";^M
^M
// format results by row^M
while (OCIFetch($sql_statement)){^M
echo "<TR>";^M
for ($i = 0; $i < $num_columns; $i++) {^M
$column_value = OCIResult($sql_statement,$i);^M
echo "<TD>$column_value</TD>";^M
}^M
echo "</TR>";^M
}^M
^M
echo "</TABLE>";^M
^M
// free resources and close connection^M
OCIFreeStatement($sql_result);^M
OCILogoff($connection);^M
?>
 [2008-10-15 00:07 UTC] sixd@php.net
The error indicates a user configuration error, not a bug.

Please ask this question in a support forum such as the PHP DB mail list, see http://www.php.net/mailing-lists.php or ask on
http://www.oracle.com/technology/forums/php.html

Also see http://www.oracle.com/technology/tech/php/htdocs/php_troubleshooting_faq.html#envvars
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu May 02 12:01:29 2024 UTC