|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2003-07-21 11:54 UTC] rarteaga at icaro dot com dot ec
Description:
------------
Hi, I've installed Linux RH 9.0 and Oracle 9i, I'm trying to access the database from a php script, I make de connection and make a simple select like this:
"SELECT EMPNO from EMP"
And I get the information just fine with the oci functions (OCILogon, OCIParse, OCIExecute, etc...). Now I get a segmentation fault when I try to retrieve information of fields that are string or characteres, something like this:
"SELECT JOB from EMP"
The script crashes and dies saying "segmentation fault"
I'm connecting to the database as user "SCOTT" and getting information from table EMP.
I can connect from an aplication I've developed in VB60 from a remote aplication server I have... but PHP is crashing...
Best Regards
Reproduce code:
---------------
#!/usr/bin/php -q
<?php
putenv("ORACLE_HOME=/opt/oracle/product/9.2.0");
$username = "SCOTT";
$passwd = "TIGER";
$db="icaro";
$conn = OCILogon($username,$passwd,$db);
if (!$conn) {
echo "Connection failed";
echo "Error Message: [" . OCIError($conn) . "]";
exit;
}
else {
echo "Connected!"."\n";
$parse = OCIParse($conn,"select JOB from EMP");
OCIDefineByName($parse,"ENAME",$job);
OCIExecute($parse,OCI_DEFAULT);
echo "\nRecuperacion de datos\n";
while (OCIFetchinto ($parse, $row, OCI_ASSOC)) {
echo $job;
echo "\n";
}
}
?>
Expected result:
----------------
I expect to see de job titles..
Actual result:
--------------
[root@oralinux htdocs]# ./oracle.php
Connected!
Segmentation fault
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Nov 02 12:00:01 2025 UTC |
Yes I've setted the relevant configuration variables. Among others I have the most important one: putenv("ORACLE_HOME=/opt/oracle/product/9.2.0"); I've tryed others about language, TNS NAMES, etc... None of them solved the problem, As I said is working fine until you try to make a SELECT in witch you have to get information from a varchar2() fields on the table... I've stopped using OCI8 extension for the moment, instead I'm using the oracle extension (ora_Logon, ora_Execute, etc.) and its working fine, I solved my problem so far. However OCI8 has a lot more special functions I'm interested on using... Best Regards...As you can see in the detail of this bug report, I'm not running the script from a webserver, that's why I put: #!/usr/bin/php -q to run it from the console like this: ./oracle.php I get the result in the standar output. Setting the relevant configuration variables in the script do work, if I do not put this line for example: putenv("ORACLE_HOME=/opt/oracle/product/9.2.0"); The script will simple tell me that ORACLE is not present and so on. I understand that once the script works fine, I'll have to put the correct env. variables so Apache knows ORACLE its present, mean while putenv works just fine...while (OCIFetchinto ($parse, $row, OCI_ASSOC)) { --> while (OCIFetchinto ($parse, &$row, OCI_ASSOC)) {